# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
99939 | 2019-03-08T20:23:30 Z | TadijaSebez | Gap (APIO16_gap) | C++11 | 65 ms | 2448 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+1+N-2)/(N-1); ll last=-1,ans=0; for(int i=1;i<=N-1;i++) { ll a,b; MinMax(l+block*(i-1),min(l+block*i-1,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 | 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 | 2 ms | 512 KB | Output is correct |
14 | Correct | 2 ms | 384 KB | Output is correct |
15 | Correct | 3 ms | 384 KB | Output is correct |
16 | Correct | 20 ms | 896 KB | Output is correct |
17 | Correct | 14 ms | 996 KB | Output is correct |
18 | Correct | 14 ms | 896 KB | Output is correct |
19 | Correct | 14 ms | 896 KB | Output is correct |
20 | Correct | 10 ms | 1024 KB | Output is correct |
21 | Correct | 50 ms | 2416 KB | Output is correct |
22 | Correct | 50 ms | 2288 KB | Output is correct |
23 | Correct | 55 ms | 2288 KB | Output is correct |
24 | Correct | 55 ms | 2288 KB | Output is correct |
25 | Correct | 48 ms | 2448 KB | Output is correct |
26 | Correct | 54 ms | 2344 KB | Output is correct |
27 | Correct | 52 ms | 2288 KB | Output is correct |
28 | Correct | 60 ms | 2288 KB | Output is correct |
29 | Correct | 54 ms | 2320 KB | Output is correct |
30 | Correct | 41 ms | 2288 KB | Output is correct |
31 | Correct | 2 ms | 384 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 384 KB | Output isn't correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
4 | Correct | 1 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 | 3 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 | 4 ms | 384 KB | Output is correct |
16 | Correct | 17 ms | 512 KB | Output is correct |
17 | Correct | 17 ms | 512 KB | Output is correct |
18 | Correct | 15 ms | 512 KB | Output is correct |
19 | Correct | 16 ms | 512 KB | Output is correct |
20 | Correct | 8 ms | 512 KB | Output is correct |
21 | Correct | 60 ms | 1276 KB | Output is correct |
22 | Correct | 64 ms | 1076 KB | Output is correct |
23 | Correct | 58 ms | 1144 KB | Output is correct |
24 | Correct | 64 ms | 1152 KB | Output is correct |
25 | Correct | 60 ms | 1272 KB | Output is correct |
26 | Correct | 64 ms | 1144 KB | Output is correct |
27 | Correct | 65 ms | 1144 KB | Output is correct |
28 | Correct | 62 ms | 1144 KB | Output is correct |
29 | Correct | 63 ms | 1116 KB | Output is correct |
30 | Correct | 33 ms | 1152 KB | Output is correct |
31 | Correct | 2 ms | 384 KB | Output is correct |
32 | Correct | 3 ms | 384 KB | Output is correct |