# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99940 | 2019-03-08T20:24:56 Z | TadijaSebez | Gap (APIO16_gap) | C++11 | 76 ms | 2484 KB |
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define ll long long const ll lim=1e18; ll findGap(int T, int N) { if(T==1) { ll a,b,c=-1,d=-1; ll l=0,r=lim,ans=0; vector<ll> v; while(l<=r && v.size()<N) { MinMax(l,r,&a,&b); if(a!=-1) v.push_back(a); if(b!=a) v.push_back(b); l=a+1;r=b-1; } sort(v.begin(),v.end()); for(int i=1;i<v.size();i++) ans=max(ans,v[i]-v[i-1]); return ans; } else { ll l,r; MinMax(0,lim,&l,&r); ll block=(r-l+N-2)/(N-1); ll last=l,ans=0; for(int i=1;i<=N-1;i++) { ll a,b; MinMax(l+block*(i-1)+1,min(l+block*i,lim),&a,&b); if(last!=-1 && a!=-1) ans=max(ans,a-last); if(b!=-1) last=b; } return ans; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 2 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 2 ms | 384 KB | Output is correct |
16 | Correct | 13 ms | 896 KB | Output is correct |
17 | Correct | 14 ms | 912 KB | Output is correct |
18 | Correct | 14 ms | 896 KB | Output is correct |
19 | Correct | 14 ms | 896 KB | Output is correct |
20 | Correct | 11 ms | 896 KB | Output is correct |
21 | Correct | 50 ms | 2288 KB | Output is correct |
22 | Correct | 50 ms | 2484 KB | Output is correct |
23 | Correct | 76 ms | 2248 KB | Output is correct |
24 | Correct | 50 ms | 2292 KB | Output is correct |
25 | Correct | 53 ms | 2288 KB | Output is correct |
26 | Correct | 61 ms | 2288 KB | Output is correct |
27 | Correct | 53 ms | 2288 KB | Output is correct |
28 | Correct | 53 ms | 2288 KB | Output is correct |
29 | Correct | 50 ms | 2288 KB | Output is correct |
30 | Correct | 41 ms | 2260 KB | Output is correct |
31 | Correct | 2 ms | 384 KB | Output is correct |
32 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 3 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 2 ms | 384 KB | Output is correct |
5 | Correct | 2 ms | 384 KB | Output is correct |
6 | Correct | 2 ms | 384 KB | Output is correct |
7 | Correct | 2 ms | 384 KB | Output is correct |
8 | Correct | 2 ms | 384 KB | Output is correct |
9 | Correct | 2 ms | 384 KB | Output is correct |
10 | Correct | 2 ms | 384 KB | Output is correct |
11 | Correct | 3 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 3 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 18 ms | 512 KB | Output is correct |
17 | Correct | 19 ms | 512 KB | Output is correct |
18 | Correct | 16 ms | 512 KB | Output is correct |
19 | Correct | 22 ms | 512 KB | Output is correct |
20 | Correct | 9 ms | 512 KB | Output is correct |
21 | Correct | 64 ms | 1144 KB | Output is correct |
22 | Correct | 64 ms | 1072 KB | Output is correct |
23 | Correct | 64 ms | 1164 KB | Output is correct |
24 | Correct | 63 ms | 1152 KB | Output is correct |
25 | Correct | 58 ms | 1152 KB | Output is correct |
26 | Correct | 64 ms | 1152 KB | Output is correct |
27 | Correct | 63 ms | 1152 KB | Output is correct |
28 | Correct | 63 ms | 1152 KB | Output is correct |
29 | Correct | 64 ms | 1272 KB | Output is correct |
30 | Correct | 38 ms | 1276 KB | Output is correct |
31 | Correct | 2 ms | 384 KB | Output is correct |
32 | Correct | 2 ms | 384 KB | Output is correct |