# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
152599 | 2019-09-08T14:22:56 Z | Ruxandra985 | Gap (APIO16_gap) | C++14 | 79 ms | 1916 KB |
#include <cstdio> #include "gap.h" long long findGap (int t , int n){ long long l,r,i; long long st,dr,a,b,sol,x,y,len,rant; if (t == 1){ long long w[100010]; st = 1; dr = 1000000000000000000; l = 1; r = n; while (l<=r){ a=b=0; MinMax (st,dr,&a,&b); if (l < r){ w[l] = a; w[r] = b; } else { w[l] = a; } st = a + 1; dr = b - 1; l++; r--; } sol = 0; for (i=2;i<=n;i++){ if (sol < w[i] - w[i-1]) sol = w[i] - w[i-1]; } return sol; } else { MinMax (0,1000000000000000000,&a,&b); if (n == 2) return b - a; len = (b - a - 2) / (n - 2); sol = 0; rant = a; /// imparti in n - 2 bucati , e clar ca exista bucati goale /// maximul se va obtine intre 2 elem consecutive din bucati dif for ( i = a+1 ; i < b ; i+=len ){ MinMax (i , i + len - 1 , &l , &r); if (l != -1 && sol < l - rant){ sol = l - rant; if (r + sol + 1 > b) break; } if (r!=-1) rant = r; } return sol; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 380 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 256 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 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 | 256 KB | Output is correct |
10 | Correct | 2 ms | 380 KB | Output is correct |
11 | Correct | 3 ms | 376 KB | Output is correct |
12 | Correct | 2 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 | 3 ms | 376 KB | Output is correct |
16 | Correct | 16 ms | 760 KB | Output is correct |
17 | Correct | 15 ms | 760 KB | Output is correct |
18 | Correct | 15 ms | 820 KB | Output is correct |
19 | Correct | 15 ms | 760 KB | Output is correct |
20 | Correct | 11 ms | 764 KB | Output is correct |
21 | Correct | 56 ms | 1884 KB | Output is correct |
22 | Correct | 57 ms | 1868 KB | Output is correct |
23 | Correct | 55 ms | 1884 KB | Output is correct |
24 | Correct | 56 ms | 1912 KB | Output is correct |
25 | Correct | 49 ms | 1888 KB | Output is correct |
26 | Correct | 57 ms | 1916 KB | Output is correct |
27 | Correct | 56 ms | 1912 KB | Output is correct |
28 | Correct | 56 ms | 1916 KB | Output is correct |
29 | Correct | 55 ms | 1912 KB | Output is correct |
30 | Correct | 41 ms | 1912 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 | Correct | 2 ms | 376 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 | 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 | 2 ms | 256 KB | Output is correct |
11 | Correct | 3 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 | 3 ms | 376 KB | Output is correct |
16 | Correct | 19 ms | 504 KB | Output is correct |
17 | Correct | 21 ms | 504 KB | Output is correct |
18 | Correct | 19 ms | 504 KB | Output is correct |
19 | Correct | 20 ms | 504 KB | Output is correct |
20 | Correct | 9 ms | 508 KB | Output is correct |
21 | Correct | 75 ms | 1152 KB | Output is correct |
22 | Correct | 75 ms | 1144 KB | Output is correct |
23 | Correct | 74 ms | 1144 KB | Output is correct |
24 | Correct | 75 ms | 1144 KB | Output is correct |
25 | Correct | 68 ms | 1144 KB | Output is correct |
26 | Correct | 79 ms | 1016 KB | Output is correct |
27 | Correct | 75 ms | 1196 KB | Output is correct |
28 | Correct | 74 ms | 1144 KB | Output is correct |
29 | Correct | 76 ms | 1144 KB | Output is correct |
30 | Correct | 37 ms | 1144 KB | Output is correct |
31 | Correct | 2 ms | 376 KB | Output is correct |
32 | Correct | 2 ms | 256 KB | Output is correct |