# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003462 |
2024-06-20T11:12:02 Z |
amine_aroua |
Gap (APIO16_gap) |
C++17 |
|
43 ms |
2820 KB |
#include <bits/stdc++.h>
using namespace std;
#define intt long long
#define fore(i , n) for(int i = 0 ; i < n; i++)
#define forr(i , x ,y) for(int i = x; i <= y;i++)
void MinMax(intt s , intt t , intt *mn , intt *mx);
long long findGap(int T, int N)
{
intt mn , mx;
MinMax(0ll , 1LL * 1e18 , &mn , &mx);
intt gmn = mn , gmx = mx;
intt d = (mx - mn + N - 2)/(N - 1);
vector<intt> MinB(N) , MaxB(N);
fore(i , N - 1)
{
intt lt = i * d + gmn , rt = (i + 1)*d + gmn - 1;
MinMax(lt , rt , &mn , &mx);
MinB[i] = mn;
MaxB[i] = mx;
}
MinB[N - 1]= MaxB[N - 1] = mx;
intt prv = MaxB[0];
intt ans = d;
forr(i , 1 , N - 1)
{
if(MinB[i] == -1)
continue;
ans = max(ans , MaxB[i] - MinB[i]);
ans= max(ans , MinB[i] - prv);
prv = MaxB[i];
}
return ans;
}
Compilation message
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:11:21: warning: unused variable 'gmx' [-Wunused-variable]
11 | intt gmn = mn , gmx = mx;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
12 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
13 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
14 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
15 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
16 |
Incorrect |
9 ms |
948 KB |
Output isn't correct |
17 |
Incorrect |
9 ms |
856 KB |
Output isn't correct |
18 |
Incorrect |
9 ms |
856 KB |
Output isn't correct |
19 |
Incorrect |
8 ms |
856 KB |
Output isn't correct |
20 |
Incorrect |
5 ms |
856 KB |
Output isn't correct |
21 |
Incorrect |
35 ms |
2728 KB |
Output isn't correct |
22 |
Incorrect |
37 ms |
2648 KB |
Output isn't correct |
23 |
Incorrect |
40 ms |
2744 KB |
Output isn't correct |
24 |
Incorrect |
35 ms |
2648 KB |
Output isn't correct |
25 |
Incorrect |
32 ms |
2644 KB |
Output isn't correct |
26 |
Incorrect |
34 ms |
2648 KB |
Output isn't correct |
27 |
Incorrect |
36 ms |
2648 KB |
Output isn't correct |
28 |
Incorrect |
41 ms |
2648 KB |
Output isn't correct |
29 |
Incorrect |
35 ms |
2648 KB |
Output isn't correct |
30 |
Incorrect |
22 ms |
2820 KB |
Output isn't correct |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
1 ms |
344 KB |
Output is correct |
15 |
Correct |
1 ms |
344 KB |
Output is correct |
16 |
Correct |
8 ms |
1052 KB |
Output is correct |
17 |
Correct |
10 ms |
856 KB |
Output is correct |
18 |
Correct |
8 ms |
1020 KB |
Output is correct |
19 |
Correct |
8 ms |
856 KB |
Output is correct |
20 |
Correct |
5 ms |
856 KB |
Output is correct |
21 |
Correct |
34 ms |
2648 KB |
Output is correct |
22 |
Correct |
40 ms |
2796 KB |
Output is correct |
23 |
Correct |
31 ms |
2648 KB |
Output is correct |
24 |
Correct |
33 ms |
2648 KB |
Output is correct |
25 |
Correct |
32 ms |
2648 KB |
Output is correct |
26 |
Correct |
43 ms |
2648 KB |
Output is correct |
27 |
Correct |
34 ms |
2648 KB |
Output is correct |
28 |
Correct |
37 ms |
2648 KB |
Output is correct |
29 |
Correct |
35 ms |
2648 KB |
Output is correct |
30 |
Correct |
22 ms |
2648 KB |
Output is correct |
31 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
32 |
Correct |
0 ms |
408 KB |
Output is correct |