code
stringlengths
46
24k
language
stringclasses
6 values
AST_depth
int64
3
30
alphanumeric_fraction
float64
0.2
0.75
max_line_length
int64
13
399
avg_line_length
float64
5.01
139
num_lines
int64
7
299
task
stringlengths
151
14k
source
stringclasses
3 values
import sys import math from collections import defaultdict,Counter input = sys.stdin.readline def I(): return input() def II(): return int(input()) def MII(): return map(int, input().split()) def LI(): return list(input().split()) def LII(): return list(map(int, input()....
python
12
0.545558
59
7.12963
108
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include <stdio.h> int main() { int t; scanf("%d",&t); int n,k; int a[101]; while(t--) { scanf("%d %d",&n,&k); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } int c=0; for(int i=0;i<k;i++) { if(a[i]>k) { ...
c++
13
0.277778
28
6.830189
53
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
for i in range(int(input())): soll=0 lst1=list(map(int,input().split())) lst2=list(map(int,input().split())) for h in range(lst1[1]): if(lst2[h]>lst1[1]): soll+=1 print(soll)
python
13
0.518182
39
13.733333
15
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include <bits/stdc++.h> using namespace std; void test() { int n, k; cin >> n >> k; vector<int> v(n); for (int& i : v) { cin >> i; --i; } if (k == n) { cout << 0 << endl; return; } for (int i = 0;; ++i) { auto al = max_element(v.begin(), v.begin()...
c++
12
0.378472
60
17.612903
31
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") static const auto fast = []() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); return 0; } (); ; #define mod 1e9+7 #define imod ((i...
c++
13
0.532164
82
8.927536
69
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.*; public class Problem1 { static class Reader { static BufferedReader reader; static StringTokenizer tokenizer; /** call this method to initialize re...
java
15
0.502362
68
20.166667
90
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
for t in range(int(input())): n, k = map(int, input().split()) ans = 0 for i in list(map(int, input().split()))[:k]: if i > k: ans+=1 print(ans)
python
13
0.485549
49
14.818182
11
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include<bits/stdc++.h> using namespace std; #define ll long long void solve(){ int n, k, cnt=0; cin >> n >> k; int a[n+1]; for(int i=1;i<=n;i++){ cin >> a[i]; if(i<=k && a[i]>k) ++cnt; } cout << cnt << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; ...
c++
11
0.5
32
6.913043
46
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include <bits/stdc++.h> #include <iostream> #include <vector> #include <cmath> #include <string> #include <algorithm> #include <map> #include <set> #include <numeric> #include <iomanip> using namespace std; const int N = 1e7; using I = int; using SI = short int; using LI = long int; using LLI = lo...
c++
14
0.461593
106
11.844749
219
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 28 01:29:46 2023 @author: manisarthak """ import sys input = lambda: sys.stdin.readline().rstrip() def solve (): [n, k] = list(map(int, input().split())) arr = list(map(int, input().split())) s = set() for ...
python
13
0.47561
45
7.355932
59
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
t = int(input()) for f in range(t): n,k = list(map(int,input().split())) arr = list(map(int,input().split())) ct = 0 for i in range(k): if arr[i] > k: ct = ct + 1 print(ct)
python
13
0.434783
40
9.454545
22
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include <iostream> using namespace std; int n,k,x,t,f; int main(){cin>>t;while(t--){cin>>n>>k;f=0;for(int i=0;i<n;i++){cin>>x;f+=(i<k&&x>k);}cout<<f<<endl;}}
c++
12
0.57764
102
22.142857
7
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
t=int(input()) for ii in range(t): n,k=list(map(int,input().split())) a=list(map(int,input().split())) #a=sorted(a) s=0 dd=[] for i in range(k): if a[i]>k: s+=1 print(s)
python
13
0.53125
35
7.391304
23
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include <bits/stdc++.h> using namespace std; #define ll long long int main() { ll t; cin>>t; while(t--){ ll n,k,c=0; cin>>n>>k; ll a[n],b[n]; for(ll i=0;i<n;i++){ cin>>a[i]; b[i]=a[i]; } sort(b,b+n); for(ll i=0;...
c++
15
0.32582
42
8.384615
52
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
t = int(input()) for _ in range(t): n, k = [int(i) for i in input().split()] a = [int(i) for i in input().split()] req = 0 if n == k: print(0) continue for i in range(k): if a[i] > k: req += 1 print(req)
python
11
0.387755
44
7.428571
35
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
import java.util.*; public class cf { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int testcase = scan.nextInt(); // int testcase = 1; for(int v = 0; v < testcase; v++){ int n = scan.nextInt(); int k = scan.nex...
java
13
0.365682
46
8.608108
74
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
T = int(input()) for t in range(1, T+1): n, k = list(map(int, input().split())) a = list(map(int, input().split())) mp = {} for i in range(n): mp[a[i]] = i cnt = 0 for i in range(k): if a[i] > k: cnt += 1 print(cnt)
python
13
0.415493
42
10.833333
24
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
# slow one # t = int(input()) import sys # for _ in range(t): # n, k = [int(i) for i in input().split()] # a = [int(i) for i in input().split()] # req = 0 # if n == k: # print(0) # continue # for i in range(k): # if a[i] > k: # req += 1 ...
python
12
0.39924
46
7.21875
96
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
t=int(input()) for i in range(t): g=set() n,k=map(int,input().split()) a=(list(map(int,input().split()))) b=sorted(a) m=0 for j in range(k): g.add(a[j]) for j in range(k): if b[j] not in g: m+=1 print(m)
python
14
0.443636
38
10.04
25
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
import java.util.*; public class cf813A { public static void main(String[] args) { Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int k=sc.nextInt(); int arr[]=new int[n]; for(int i=0;i<n;i++){...
java
16
0.331873
48
13.265625
64
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
tst=int(input()) for i in range(tst): num,k=map(int,input().split()) arr=list(map(int,input().split())) c=0 if num==k: c=0 else: for j in range(1,k+1): if arr[j-1]!=j and arr[j-1]>k: c=c+1 print(c)
python
13
0.432624
42
10.32
25
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
def main(): t = int(input()) for i in range(t): n, k= map(int, input().split()) p = list(map(int, input().split())) counter = 0 for j in range(k): if p[j] <= k: counter += 1 print(k - counter) main()
python
15
0.391304
43
12.043478
23
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
import java.util.*; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { try { FastScanner sc = new FastScanner(); int T = Integer.parseInt(sc.next()); while (T...
java
16
0.417323
81
13.693878
147
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
def solve(n,k,p): res = 0 s = set(p[:k]) for i in range(1,k+1): if i not in s: res +=1 return res t = int(input()) for i in range(t): n,k = map(int,input().split()) p =[int(x) for x in input().split()] print(solve(n,k,p))
python
11
0.439189
40
6.789474
38
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
/*package whatever //do not write package name here */ import java.util.Scanner; import java.util.Arrays; public class code{ public static boolean is_there(int[] arr , int k1){ for(int i = 0;i<arr.length;i++){ if(arr[i]==k1){ return true; } } ...
java
17
0.384668
55
13.475248
101
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include<bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int a[maxn]; void solve() { int n, k,cnt=0; cin >> n >> k; for(int i=0;i<n;i++) cin >> a[i]; for(int i=0;i<k;i++) if (a[i] > k)cnt++; printf("%d\n", cnt); } int main() { int t; cin >> t; while (t--)solve(); }
c++
9
0.491961
26
7
39
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
import java.util.*; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); int test = input.nextInt(); while(test > 0) { int n = input.nextInt(); int k = input.nextInt(); int[] a = new int[n]; for(in...
java
13
0.421147
45
11.422222
45
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
import java.io.*; import java.util.*; public class R813A { public static void main(String[] args) { JS scan = new JS(); int cases = scan.nextInt(); while(cases-->0){ int n = scan.nextInt(), k = scan.nextInt(); int[] arr = new int[n]; int[] pos =...
java
16
0.376049
79
13.476636
214
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
#include<bits/stdc++.h> using namespace std; //#typedef ios_base::sync_with_stdio(false);cin.tie(NULL); Fast I/O typedef long long ll; #define forf(i,a,n) for(ll i = a; i < n; i++) #define forb(i,a,n) for(ll i = a; i >= n; i--) #define pb push_back #define all(v) (v).begin(),(v).end() #define mp make_pair #def...
c++
12
0.624476
112
13.752577
97
A. Wonderful Permutationtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputGod's Blessing on This PermutationForces!A Random PebbleYou are given a permutation $$$p_1,p_2,\ldots,p_n$$$ of length $$$n$$$ and a positive integer $$$k \le n$$$. In one operation you can choos...
cf
import java.util.*; public class sortZero { public static void main(String[] swami){ Scanner sc=new Scanner(System.in); int t=sc.nextInt(); while(t-->0){ int n=sc.nextInt(); int[] a=new int[n]; a[0]=sc.nextInt(); boolean issorted=true; ...
java
18
0.319695
72
24.75
56
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include<bits/stdc++.h> using namespace std; int t,n,a[100005]; int main(){ cin>>t; while(t--){ set<int>st; cin>>n;int ans=0; for(int i=1;i<=n;i++){ cin>>a[i]; if(i==1) continue; if(a[i]!=a[i-1]) st.insert(a[i-1]); if(a[i]<a[i-1]) ans=st.size(); if(st.count(a[...
c++
14
0.450633
24
6.764706
51
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include <cstdio> #include <vector> #include <set> int main(){ long t; scanf("%ld", &t); while(t--){ long n; scanf("%ld", &n); std::vector<long> a(n); for(long p = 0; p < n; p++){scanf("%ld", &a[p]);} std::set<long> s; long cur(a.back()); for(long p = n - 2;...
c++
15
0.387247
81
11.150943
53
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ub upper_bound #define lb lower_bound #define ll long long #define ld long double #define pii pair<ll, ll> typedef __int128 lll; typedef vector<ll> vi; typedef vector<vi> vvi; typedef vector<pii> vpi; typedef set<ll> si; typedef map...
c++
12
0.486943
68
7.194969
159
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
for _ in range(int(input().strip())): n=int(input().strip()) # blank=input().strip() # n,x,c=map(int,input().strip().split()) # s=(input().strip()) a=list(map(int,input().strip().split())) # s=list(input().strip()) l = len(a)-1 while l>0 and a[l-1] <= a[l]: l -= 1 s...
python
15
0.447537
44
13.181818
33
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
import math for _ in range(int(input())): n = int(input()) arr = list(map(int,input().split())) if(arr==sorted(arr)): print(0) else: i = n-1 while(arr[i-1]<=arr[i]): i-=1 x = set(arr[:i]) r = -1 for i in range(n-1,-1,-1): ...
python
14
0.360396
40
11.341463
41
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#Khushal Sindhav #Indian Institute Of Technology, Jodhpur # 18 Dec 2022 def exe(): for i in range(n-1,0,-1): if lst[i]>=lst[i-1]: pass else: index=i break else: return 0 d={} for i in lst: d[i]=0 for i in range(index)...
python
13
0.465487
40
10.098039
51
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include<bits/stdc++.h> using namespace std; #define ll long long #define all(x) (x).begin(),(x).end() #define ull unsigned long long #define ld long double #define pb push_back #define fi first #define se second #define umap unordered_map #define lb lower_bound #define ub upper_bound #define nl "\n" const...
c++
15
0.533188
40
9.574713
87
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
import java.util.*; public class CF816{ static Scanner in = new Scanner(System.in); static void solve(){ int n = in.nextInt(); int[] a= new int[n + 1]; for(int i = 1; i <= n; i++){ a[i] = in.nextInt(); } int[] suffixMin = new int...
java
17
0.320261
60
12.691057
123
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native") static const auto fast = []() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); return 0; } (); ; #define mod 1e9+7 #define imod ((i...
c++
18
0.415606
82
9.26087
115
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
N = int(input()) for _ in range(N): input() arr = list(map(int, input().split())) if len(arr) <= 1: print(0) continue seen = {arr[-1]: len(arr) - 1} ans = 0 invalid = False i = len(arr) - 2 while i >= 0: index = i if arr[i] > arr[i + 1...
python
17
0.375516
52
10.555556
63
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
for i in range(int(input())): n=int(input()) p=list(map(int,input().split())) b=set() c=0 for j in range(1,len(p)): if p[j]<p[j-1] or p[j] in b: for k in p[c:j]: b.add(k) c=j print(len(b))
python
13
0.390071
36
12.47619
21
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
/*package whatever //do not write package name here */ import java.io.*; import java.net.ConnectException; import java.util.*; public class codeforces { static Scanner sc=new Scanner(System.in); static PrintWriter out=new PrintWriter(System.out); static void solve(){ int n=sc.nextInt(); ...
java
16
0.449117
55
13
85
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include<bits/stdc++.h> using namespace std; int a[100010],f[100010]; int main() { int t; cin>>t; while(t--) { int n,temp=-1; cin>>n; map<int,int> mp; for(int i=0;i<n;i++) { cin>>a[i]; f[a[i]]=0; mp[a[i]]=max(mp[a[i]],i); } if(n==1){cout<<0<<'\n';continue; } for(int i=...
c++
15
0.416914
38
6.326087
92
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 28 01:29:46 2023 @author: manisarthak """ import sys input = lambda: sys.stdin.readline().rstrip() def solve (): [n] = list(map(int, input().split())) arr = list(map(int, input().split())) # n = 4 # arr = [...
python
19
0.344992
50
9.579832
119
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef long long ll; typedef unsigned long long ull; void solve() { int n; cin >> n; int arr[n+1]={0}; set<int>st; int freq[n+1]={0}; for(int i = 1 ; i <= n ...
c++
16
0.42116
40
8.742574
101
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
import java.io.*; import java.util.*; public class R813C { public static void main(String[] args) { JS scan = new JS(); int cases = scan.nextInt(); while(cases-->0){ int n = scan.nextInt(); int[] arr =new int[n]; boolean[] bad = new boolean[n]; ...
java
16
0.360116
79
13.416667
240
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
for t in range(int(input())): n = int(input()) arr = list(map(int, input().split())) minn=arr[-1] rem_arr = set() for i in range(n-1,-1,-1): if arr[i]<=minn: minn=arr[i] else: minn=0 rem_arr.add(arr[i]) flag=False for i in range...
python
13
0.437229
41
12.228571
35
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; import java.util.Set; //https://codeforces.com/problemset/problem/1712/C public class C1712 { static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static v...
java
17
0.441907
84
30.680851
47
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
from sys import stdin from math import log,floor,ceil,gcd from collections import defaultdict as dd #from bisect import bisect_left as bl,bisect_right as br,insort as ins #from itertools import groupby as gb #from heapq import heapify as hpf, heappush as hpush, heappop as hpop #from collections import deque #from itert...
python
14
0.539354
70
25.844444
45
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
from collections import deque def updateZeros(prev): global zerod, toZero, count, q if prev in toZero: for val in toZero[prev]: if val not in zerod: zerod.add(val) q.append(val) count += 1 t = int(input()) for test in range(t): ...
python
15
0.442216
42
11.768293
82
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include<bits/stdc++.h> #define endl '\n' #define all(v) v.begin(), v.end() #define pb push_back #define ppb pop_back #define vl vector<long long> #define ff first #define ss second #define vi vector<int> #define set_bits(a) __builtin_popcountll(a) #define pll pair<ll,ll> #define cin(v) {int x; cin>>x; v.pus...
c++
12
0.452092
80
10.150376
133
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include<bits/stdc++.h> using namespace std; #define ll long long int #define endl "\n" #define all(v) v.begin(), v.end() #define vll vector<long long int> #define vi vector<int> #define vs vector<string> #define vii vector<pair<int,int>> #define p...
c++
12
0.401904
77
8.140097
207
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <functional> using namespace std; using namespace __gnu_pbds; #define ll long long #define ld long double #define Fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define pb pu...
c++
19
0.385375
77
11.185792
183
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
import java.io.DataOutput; import java.io.PrintWriter; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); // System.out.println(sc.nextByte()); PrintWriter pw = new PrintWriter(System.out); // ...
java
13
0.392417
77
14.87218
133
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include<bits/stdc++.h> using namespace std; #define int long long #define dg(x) cout<<#x<<'='<<x<<'\n' const int N=1e5+10; int a[N]; int mp[N]; void solve() { int n; cin>>n; for(int i=1;i<=n;i++) cin>>a[i],mp[i]=0; int ans=0; queue<int>q; q.push(a[1]); for(int i=2;i<=n;i++){ if(mp[a[i]]=...
c++
17
0.462006
48
6.404494
89
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include <bits/stdc++.h> using namespace std; #define ll long long int int main() { ll t; cin >> t; while (t--) { ll n; cin >> n; vector<ll> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } vector<ll> a = v; ...
c++
17
0.245
47
10.111111
126
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
import java.util.HashSet; import java.util.Scanner; public class SortZero1712C { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int tests = sc.nextInt(); while (tests-->0) { int n = sc.nextInt(); int a[] = new in...
java
14
0.318374
51
10.141509
106
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
#include<bits/stdc++.h> using namespace std; #define endl "\n" #define read(arr) for(auto &x : arr) cin>>x; #define print(arr) for(auto &x: arr) cout<<x<<" "; cout<<endl; #define sortv(arr) sort(arr.begin(), arr.end()) #define sorta(arr) sort(arr.begin(), arr.end()) #define revers(arr) reverse(arr.begin(), arr...
c++
15
0.520742
62
8.453608
97
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
from collections import Counter, defaultdict, deque import os import sys # from math import gcd, ceil, sqrt # from bisect import bisect_left, bisect_right # import math, bisect, heapq, random # from functools import lru_cache, reduce, cmp_to_key # from itertools import accumulate, combinations, permutations fro...
python
17
0.53504
209
17.214724
163
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
from sys import stdin, stdout input = stdin.readline from collections import defaultdict, Counter, deque for _ in range(int(input())): n = int(stdin.readline()) l = list(map(int, stdin.readline().split())) switch = set() for i in range(n-1): # O(n**2) if not l[i] in swi...
python
13
0.482704
51
10.581818
55
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
import io, os input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline def sorts(a, k, n): s = set() lens = 0 b = a.copy() for i in range(n): if a[i] in s: b[i] = 0 elif lens<k: s.add(a[i]) b[i] = 0 lens += 1 c = b.copy() ...
python
12
0.433432
60
19.484848
33
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
for _ in range(int(input())): n = int(input()) arr_list = list(map(int, input().split())) s = set() f = 0 ans = 0 for i in range(1,n): if arr_list[i] in s or arr_list[i] < arr_list[i-1]: for j in arr_list[f:i]: s.add(j) f=i prin...
python
13
0.42042
59
10.1
30
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
t = int(input()) for i in range(t): len_1 = int(input()) lst1 = list(map(int,input().split())) dct1 = {} lstcount = [] count = 0 for j in range(len_1): dct1[j+1] = [] for k in range(len_1): if dct1[lst1[k]] == []: count += 1 dct1[lst1[k]].appe...
python
16
0.383526
43
10.969231
65
C. Sort Zerotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAn array is sorted if it has no inversionsA Young BoyYou are given an array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$. In one operation you do the following: Choose any integer $$$x$$$. For al...
cf
// Author: Aaron He // Created: 11 January 2023 (Wednesday) #include <bits/stdc++.h> using namespace std; // Based on editorial solution int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n, k; cin >> n >> k; vector<int> a(n); for (int i = 0; i < n...
c++
19
0.389798
51
8.114035
114
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import sys; input = sys.stdin.readline def solve(): n, k = map(int, input().split()) a = list(map(int, input().split())) # 이분 탐색 start = 0; end = 1000000000 result = 0 while start <= end: mid = (start + end) // 2 arr = a[:] # 배열 복사 K = k # 남은 작업 수 ...
python
18
0.402644
67
12.110236
127
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import sys from array import array input = lambda: sys.stdin.readline().rstrip("\r\n") inp = lambda dtype: [dtype(x) for x in input().split()] debug = lambda *x: print(*x, file=sys.stderr) ceil1 = lambda a, b: (a + b - 1) // b out, tests = [], int(input()) def solve(a): mi = ans = min(a) for i ...
python
16
0.457447
59
11.309524
84
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
// LUOGU_RID: 99112796 #include <bits/stdc++.h> // #include <iostream> #define IOS std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0); using namespace std; #define INF 0x3f3f3f3f #define endl '\n' #define int long long using pll = std::pair<int, int>; const int g = 1000000000; void solv() { ...
c++
13
0.422939
78
11.137681
138
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
for _ in range(int(input())): n, k = map(int, input().split()) arr = list(map(int, input().split())) if n == k: print(10 ** 9) continue sa = sorted([[v, i] for i, v in enumerate(arr)]) lo, hi = min(arr), 10 ** 9 while lo < hi: mid = (lo + hi + 1) // 2 cn...
python
16
0.324144
52
13.04
75
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
t = int(input()) for test in range(t): n, k = map(int, input().split()) nums = list(map(int, input().split())) numSorted = list(enumerate(nums)) numSorted.sort(key = lambda x: x[1]) ptr = 0 # print(numSorted) # print(nums) # changed = set() flag = False if k == len...
python
16
0.489485
88
14.322222
90
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import sys input = sys.stdin.readline def solve(): n, k = map(int, input().split()) arr = list(map(int, input().split())) if n == k: return 10 ** 9 lo, hi = min(arr), 10 ** 9 sa = sorted([[v, i] for i, v in enumerate(arr)]) while lo < hi: mid = (lo + hi + 1) // 2 ...
python
16
0.334448
52
11.090909
99
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include <bits/stdc++.h> using namespace std; #define int long long #define INF 1e9 #define endl '\n' const int N = 2e5 + 10; int n,m,q,k; int a[N]; string s; typedef pair<int, int> PII; struct Node { int id, w; bool operator < (const Node &t) const { return w < t.w; } }p[N]; ...
c++
13
0.417591
66
8.790698
129
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import java.io.*; import java.util.*; public class d { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); int nc = Integer.parseInt(in.readLine()); for (int cn = 0; cn < nc; cn++) { StringTo...
java
16
0.401493
108
16.076433
157
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' const int maxn=1e5+11; const int Maxx=5000+11; const int mod=19260817; int t; int n,k; ll a[maxn]; int vis[maxn]; void solve() { cin>>n>>k; for(int i=1;i<=n;++i) cin>>a[i]; priority_queue<pair<ll,int>,vect...
c++
15
0.492604
79
12.39604
101
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
for _ in range(int(input())): n,k=map(int,input().split()) a=list(map(int,input().split())) if k==n: print(10**9) continue b=[] for i in range(n): b.append((a[i],i)) b.sort() i=0 while k>1: a[b[i][1]]=10**9 i+=1 k-=1 ans=...
python
13
0.381038
53
10.428571
49
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import java.io.*; import java.util.*; public class EmptyGraph { public static void main(String[] args) throws IOException { // BufferedReader in = new BufferedReader(new FileReader("EmptyGraph.in")); // PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("EmptyGraph.out"))); BufferedReader in = ...
java
19
0.547257
93
24.233333
60
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
/// What are you doing now? Just go f*cking code now dude? #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define TASK "codin" //#define int long long using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long llu; #define IO ios_base::sync_with_stdio(false);cin.tie(0...
c++
13
0.426548
83
9.765957
282
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include <bits/stdc++.h> using namespace std; using LL = long long; #define endl '\n' using db = double; template <class T> using max_heap = priority_queue<T>; template <class T> using min_heap = priority_queue<T, vector<T>, greater<>>; void solve() { int n, m; cin >> n >> m; vector<int> ...
c++
17
0.324499
63
10.136691
139
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import sys input=sys.stdin.readline max_value=10**9 def check(target): y=x.copy() ans=0 for i in range(n): if y[i]<(target+1)//2: ans+=1 y[i]=max_value best_value=-1 for i in range(n-1): best_value=max(best_value,min(y[i],y[i+1])) if best_valu...
python
13
0.471831
51
10.833333
60
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; template <class T> using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template <class K, class V> using omap = tree<K, V, le...
c++
20
0.472843
118
12.555118
254
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
/* the length must be min(d(i,i+1),2*m) (m is the shortest length of the graph) as we know this, so the goal is to make d(i,i+1) or 2*m great if the answer is d(i,i+1) then we just need to make a[i] equals to ANS if the answer is 2*m ,then we need to maximize it, so we could just make */ #include <bits/s...
c++
14
0.584572
104
11.738739
111
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import sys; input = sys.stdin.readline def solve(): n, k = map(int, input().split()) a = list(map(int, input().split())) # 이분 탐색 start = 0; end = 1000000000 result = 0 while start <= end: mid = (start + end) // 2 arr = a[:] # 배열 복사 K = k # 남은 작업 수 ...
python
18
0.411939
74
13.470085
117
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include<bits/stdc++.h> using namespace std; int mxm=1000000000; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; while(t>0){ t--; int n,k; cin >> n >> k; vector<int> a(n); for(auto &nx : a){cin >> nx;} int l=0,r=mxm; while(l<=r){ ...
c++
18
0.426817
62
9.619565
92
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <random> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef unsigned long long ull; typedef tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; #define AboTaha_on_da_c...
c++
17
0.474733
97
11.442478
113
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
//check editorial #include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "algo/debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while (tt--) { int n, k; cin >> n >> k; vector<int> a(n); fo...
c++
18
0.363411
72
8.901639
122
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include <bits/stdc++.h> using namespace std; #define fastio cin.tie(0)->sync_with_stdio(0) using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; void solve() { int n, k; cin >> n >> k; vector<int> a(n); for(int i = 0; i < n; i++) { cin >> a[i]; } ...
c++
16
0.337339
57
10.104762
105
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
import random import sys sys.setrecursionlimit(1000000000) from collections import defaultdict, deque from functools import lru_cache from bisect import bisect_left, bisect_right, insort_right, insort_left import heapq from itertools import accumulate # list(map(int, input().strip().split(' '))) # int(in...
python
19
0.470817
74
10.681818
110
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
/* 6 3 1 2 4 1 3 2 1 9 84 3 1 10 2 6 3 2 179 17 1000000000 2 1 5 9 2 2 4 2 1 5 2 3 1 5 4 4 expect 8 1 2 3 4 5 6 */ import java.util.*; import java.io.*; public class Main{ public static int n; public static int k; //# of operations that you can do public static int mx; //max of ...
java
16
0.555229
224
12.160221
181
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
#include <bits/stdc++.h> using namespace std; #define pb push_back #define fs first #define sc second #define sz(x) (int)(x.size()) typedef long long ll; typedef pair<int, int> pii; typedef pair<int, ll> pil; typedef pair<ll, ll> pll; typedef priority_queue <ll, vector<ll>, greater<ll>> pqmin; const int ...
c++
14
0.391055
59
8.178947
190
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf
/* * * @UtkarshAgarwal */ import java.util.Arrays; import java.util.OptionalInt; import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int t = scanner.nextInt(); while(t-- > 0){ ...
java
16
0.403697
62
11.9
130
D. Empty Graphtime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output — Do you have a wish?  — I want people to stop gifting each other arrays.O_o and Another Young BoyAn array of $$$n$$$ positive integers $$$a_1,a_2,\ldots,a_n$$$ fell down on you from the skies, along w...
cf