#include "gap.h"
#include <set>
using namespace std;
long long findGap(int t, int n){
set <long long> numbers;
long long m, M;
if(t==1){
m=0;
M=1000000000000000000;
while(true){
MinMax(m, M, &m, &M);
if(m==-1)
break;
numbers.insert(m);
if(m==M)
break;
numbers.insert(M);
m++;M--;
}
}else if(t==2){
for(int i = 0;i < n>>1;i ++){
m=(long double)i*1e18/(n>>1);
if(i==(n>>1)-1)
M=1000000000000000000;
else
M=(long double)(i+1)*1e18/(n>>1)-1;
while(true){
MinMax(m, M, &m, &M);
if(m==-1)
break;
numbers.insert(m);
if(m==M)
break;
numbers.insert(M);
m++;M--;
}
}
}
m=0;
set <long long>::iterator it=numbers.begin();
M=*it;
while(++it!=numbers.end()){
m=max(m, *it-M);
M=*it;
}
return m;
}
# |
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 |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
3 ms |
256 KB |
Output is correct |
6 |
Incorrect |
3 ms |
256 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
10 |
Runtime error |
3 ms |
384 KB |
Execution failed because the return code was nonzero |
11 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
12 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
13 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
14 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
15 |
Incorrect |
3 ms |
384 KB |
Output isn't correct |
16 |
Incorrect |
20 ms |
1664 KB |
Output isn't correct |
17 |
Incorrect |
19 ms |
1656 KB |
Output isn't correct |
18 |
Incorrect |
19 ms |
1664 KB |
Output isn't correct |
19 |
Incorrect |
19 ms |
1664 KB |
Output isn't correct |
20 |
Runtime error |
20 ms |
1792 KB |
Execution failed because the return code was nonzero |
21 |
Incorrect |
83 ms |
5880 KB |
Output isn't correct |
22 |
Incorrect |
84 ms |
5752 KB |
Output isn't correct |
23 |
Incorrect |
85 ms |
5768 KB |
Output isn't correct |
24 |
Incorrect |
94 ms |
5752 KB |
Output isn't correct |
25 |
Incorrect |
73 ms |
5828 KB |
Output isn't correct |
26 |
Incorrect |
80 ms |
5752 KB |
Output isn't correct |
27 |
Incorrect |
89 ms |
5880 KB |
Output isn't correct |
28 |
Incorrect |
89 ms |
5880 KB |
Output isn't correct |
29 |
Incorrect |
101 ms |
5880 KB |
Output isn't correct |
30 |
Runtime error |
55 ms |
5752 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
356 KB |
Output is correct |
5 |
Partially correct |
2 ms |
256 KB |
Partially correct |
6 |
Correct |
2 ms |
256 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
11 |
Correct |
3 ms |
384 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
3 ms |
384 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Partially correct |
3 ms |
384 KB |
Partially correct |
16 |
Correct |
23 ms |
1656 KB |
Output is correct |
17 |
Correct |
29 ms |
1656 KB |
Output is correct |
18 |
Correct |
22 ms |
1664 KB |
Output is correct |
19 |
Correct |
23 ms |
1664 KB |
Output is correct |
20 |
Runtime error |
13 ms |
1664 KB |
Execution failed because the return code was nonzero |
21 |
Correct |
96 ms |
5748 KB |
Output is correct |
22 |
Correct |
92 ms |
5880 KB |
Output is correct |
23 |
Correct |
92 ms |
5736 KB |
Output is correct |
24 |
Correct |
87 ms |
5764 KB |
Output is correct |
25 |
Incorrect |
94 ms |
5756 KB |
Expected int32, but "2500150000" found |
26 |
Correct |
84 ms |
5852 KB |
Output is correct |
27 |
Correct |
86 ms |
5752 KB |
Output is correct |
28 |
Correct |
95 ms |
5800 KB |
Output is correct |
29 |
Correct |
89 ms |
5812 KB |
Output is correct |
30 |
Runtime error |
61 ms |
5896 KB |
Execution failed because the return code was nonzero |
31 |
Runtime error |
2 ms |
256 KB |
Execution failed because the return code was nonzero |
32 |
Runtime error |
2 ms |
384 KB |
Execution failed because the return code was nonzero |