# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
187331 |
2020-01-12T17:43:24 Z |
rzbt |
Gap (APIO16_gap) |
C++14 |
|
2000 ms |
1272 KB |
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define MAXN 100005
#include "gap.h"
typedef long long ll;
using namespace std;
ll findGap(int t,int n){
if(t==1){ll res=0;
ll l,d,tl,td;
MinMax(0ll,1000000000000000000ll,&l,&d);
while(n>2){
MinMax(l+1,d-1,&tl,&td);
//printf(" %lld %lld %lld %lld\n",l,d,tl,td);
res=max(res,max(tl-l,d-td));
l=tl;
d=td;
n-=2;
}
if(n==2)res=max(res,d-l);
return res;
}
ll l,d,res=0;
MinMax(0ll,1000000000000000000ll,&l,&d);
ll korak=(d-l)/(n-1);
ll tl=l+1,kolko,a,b;
ll prosli=l;
while(tl<=d){
MinMax(tl,tl+korak, &a, &b);
if(a==-1){
tl+=korak+1;
}else{
res=max(res,a-prosli);
prosli=b;
tl=korak+1;
}
}
return res;
}
Compilation message
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:32:15: warning: unused variable 'kolko' [-Wunused-variable]
ll tl=l+1,kolko,a,b;
^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
504 KB |
Output is correct |
2 |
Correct |
10 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
252 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
3 ms |
376 KB |
Output is correct |
11 |
Correct |
4 ms |
376 KB |
Output is correct |
12 |
Correct |
3 ms |
376 KB |
Output is correct |
13 |
Correct |
3 ms |
376 KB |
Output is correct |
14 |
Correct |
3 ms |
376 KB |
Output is correct |
15 |
Correct |
2 ms |
376 KB |
Output is correct |
16 |
Correct |
15 ms |
504 KB |
Output is correct |
17 |
Correct |
15 ms |
504 KB |
Output is correct |
18 |
Correct |
15 ms |
504 KB |
Output is correct |
19 |
Correct |
14 ms |
504 KB |
Output is correct |
20 |
Correct |
11 ms |
376 KB |
Output is correct |
21 |
Correct |
54 ms |
1116 KB |
Output is correct |
22 |
Correct |
53 ms |
1144 KB |
Output is correct |
23 |
Correct |
53 ms |
1104 KB |
Output is correct |
24 |
Correct |
53 ms |
1144 KB |
Output is correct |
25 |
Correct |
46 ms |
1272 KB |
Output is correct |
26 |
Correct |
51 ms |
1144 KB |
Output is correct |
27 |
Correct |
53 ms |
1144 KB |
Output is correct |
28 |
Correct |
53 ms |
1144 KB |
Output is correct |
29 |
Correct |
52 ms |
1144 KB |
Output is correct |
30 |
Correct |
39 ms |
1144 KB |
Output is correct |
31 |
Correct |
2 ms |
376 KB |
Output is correct |
32 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2076 ms |
256 KB |
Time limit exceeded |
2 |
Execution timed out |
2032 ms |
256 KB |
Time limit exceeded |
3 |
Execution timed out |
2015 ms |
376 KB |
Time limit exceeded |
4 |
Execution timed out |
2027 ms |
376 KB |
Time limit exceeded |
5 |
Execution timed out |
2040 ms |
376 KB |
Time limit exceeded |
6 |
Execution timed out |
2041 ms |
376 KB |
Time limit exceeded |
7 |
Execution timed out |
2021 ms |
376 KB |
Time limit exceeded |
8 |
Execution timed out |
2033 ms |
376 KB |
Time limit exceeded |
9 |
Execution timed out |
2025 ms |
376 KB |
Time limit exceeded |
10 |
Execution timed out |
2050 ms |
252 KB |
Time limit exceeded |
11 |
Execution timed out |
2037 ms |
376 KB |
Time limit exceeded |
12 |
Execution timed out |
2043 ms |
376 KB |
Time limit exceeded |
13 |
Execution timed out |
2017 ms |
376 KB |
Time limit exceeded |
14 |
Execution timed out |
2040 ms |
376 KB |
Time limit exceeded |
15 |
Execution timed out |
2040 ms |
376 KB |
Time limit exceeded |
16 |
Execution timed out |
2053 ms |
504 KB |
Time limit exceeded |
17 |
Execution timed out |
2045 ms |
504 KB |
Time limit exceeded |
18 |
Execution timed out |
2003 ms |
504 KB |
Time limit exceeded |
19 |
Execution timed out |
2037 ms |
504 KB |
Time limit exceeded |
20 |
Execution timed out |
2095 ms |
488 KB |
Time limit exceeded |
21 |
Execution timed out |
2047 ms |
1144 KB |
Time limit exceeded |
22 |
Execution timed out |
2045 ms |
1144 KB |
Time limit exceeded |
23 |
Execution timed out |
2061 ms |
1076 KB |
Time limit exceeded |
24 |
Execution timed out |
2045 ms |
1144 KB |
Time limit exceeded |
25 |
Execution timed out |
2027 ms |
1144 KB |
Time limit exceeded |
26 |
Execution timed out |
2059 ms |
1144 KB |
Time limit exceeded |
27 |
Execution timed out |
2037 ms |
1144 KB |
Time limit exceeded |
28 |
Execution timed out |
2073 ms |
1144 KB |
Time limit exceeded |
29 |
Execution timed out |
2093 ms |
1144 KB |
Time limit exceeded |
30 |
Execution timed out |
2019 ms |
1144 KB |
Time limit exceeded |
31 |
Execution timed out |
2033 ms |
376 KB |
Time limit exceeded |
32 |
Execution timed out |
2056 ms |
380 KB |
Time limit exceeded |