# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1003459 |
2024-06-20T11:06:58 Z |
amine_aroua |
Gap (APIO16_gap) |
C++17 |
|
44 ms |
2776 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)
{
intt lt = i * d + gmn , rt = (i + 1)*d + gmn - 1;
MinMax(lt , rt , &mn , &mx);
MinB[i] = mn;
MaxB[i] = 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 |
0 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 |
344 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 |
7 ms |
856 KB |
Output isn't correct |
17 |
Incorrect |
7 ms |
856 KB |
Output isn't correct |
18 |
Incorrect |
9 ms |
1052 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 |
34 ms |
2648 KB |
Output isn't correct |
22 |
Incorrect |
34 ms |
2616 KB |
Output isn't correct |
23 |
Incorrect |
44 ms |
2648 KB |
Output isn't correct |
24 |
Incorrect |
35 ms |
2648 KB |
Output isn't correct |
25 |
Incorrect |
35 ms |
2648 KB |
Output isn't correct |
26 |
Incorrect |
34 ms |
2648 KB |
Output isn't correct |
27 |
Incorrect |
44 ms |
2776 KB |
Output isn't correct |
28 |
Incorrect |
34 ms |
2648 KB |
Output isn't correct |
29 |
Incorrect |
41 ms |
2648 KB |
Output isn't correct |
30 |
Incorrect |
27 ms |
2648 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 |
Partially correct |
0 ms |
344 KB |
Partially correct |
2 |
Partially correct |
0 ms |
344 KB |
Partially correct |
3 |
Partially correct |
0 ms |
344 KB |
Partially correct |
4 |
Partially correct |
0 ms |
344 KB |
Partially correct |
5 |
Partially correct |
0 ms |
344 KB |
Partially correct |
6 |
Partially correct |
0 ms |
344 KB |
Partially correct |
7 |
Partially correct |
0 ms |
344 KB |
Partially correct |
8 |
Partially correct |
1 ms |
344 KB |
Partially correct |
9 |
Partially correct |
0 ms |
344 KB |
Partially correct |
10 |
Partially correct |
1 ms |
344 KB |
Partially correct |
11 |
Partially correct |
1 ms |
344 KB |
Partially correct |
12 |
Partially correct |
1 ms |
344 KB |
Partially correct |
13 |
Partially correct |
1 ms |
344 KB |
Partially correct |
14 |
Partially correct |
1 ms |
344 KB |
Partially correct |
15 |
Partially correct |
1 ms |
344 KB |
Partially correct |
16 |
Partially correct |
8 ms |
856 KB |
Partially correct |
17 |
Partially correct |
8 ms |
1060 KB |
Partially correct |
18 |
Partially correct |
8 ms |
856 KB |
Partially correct |
19 |
Partially correct |
8 ms |
856 KB |
Partially correct |
20 |
Partially correct |
5 ms |
856 KB |
Partially correct |
21 |
Partially correct |
36 ms |
2644 KB |
Partially correct |
22 |
Partially correct |
34 ms |
2648 KB |
Partially correct |
23 |
Partially correct |
38 ms |
2648 KB |
Partially correct |
24 |
Partially correct |
34 ms |
2648 KB |
Partially correct |
25 |
Partially correct |
33 ms |
2648 KB |
Partially correct |
26 |
Partially correct |
37 ms |
2660 KB |
Partially correct |
27 |
Partially correct |
34 ms |
2648 KB |
Partially correct |
28 |
Partially correct |
44 ms |
2648 KB |
Partially correct |
29 |
Partially correct |
34 ms |
2644 KB |
Partially correct |
30 |
Partially correct |
29 ms |
2648 KB |
Partially correct |
31 |
Partially correct |
0 ms |
344 KB |
Partially correct |
32 |
Partially correct |
0 ms |
344 KB |
Partially correct |