Submission #970810

# Submission time Handle Problem Language Result Execution time Memory
970810 2024-04-27T10:23:50 Z vjudge1 Gap (APIO16_gap) C++14
12.8863 / 100
45 ms 3104 KB
#include "gap.h"

#include <bits/stdc++.h>

using namespace std;

#define int long long

int dnc(int l, int r){
   if (l>=r) return 0;
   int mid=(l+r)>>1;
   int l1, r1, l2, r2;
   MinMax(l, mid, &l1, &r1);
   MinMax(mid+1, r, &l2, &r2);
   int ll=l1;
   if (ll==-1) ll=l2;
   int rr=r2;
   if (rr==-1) rr=r1;
   if (ll==-1 || rr==-1) return r-l+2;
   return max({(r+1)-rr, ll-(l-1), (l2==-1 || r1==-1)?0:l2-r1, dnc(l1+1, r1-1), dnc(l2+1, r2-1)});
}

long long findGap(int32_t T, int32_t N)
{
   int l, r;
   MinMax(0, 1e18, &l, &r);
   if (N==2) return r-l;
   if (r-l==2) return 1;
	return dnc(l+1, r-1);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 2392 KB Output isn't correct
3 Incorrect 1 ms 2392 KB Output isn't correct
4 Incorrect 1 ms 2392 KB Output isn't correct
5 Incorrect 1 ms 2392 KB Output isn't correct
6 Incorrect 1 ms 2392 KB Output isn't correct
7 Incorrect 1 ms 2392 KB Output isn't correct
8 Incorrect 1 ms 2392 KB Output isn't correct
9 Incorrect 1 ms 2392 KB Output isn't correct
10 Correct 1 ms 2644 KB Output is correct
11 Incorrect 1 ms 2392 KB Output isn't correct
12 Incorrect 1 ms 2392 KB Output isn't correct
13 Incorrect 2 ms 2392 KB Output isn't correct
14 Incorrect 2 ms 2644 KB Output isn't correct
15 Incorrect 2 ms 2392 KB Output isn't correct
16 Incorrect 10 ms 2588 KB Output isn't correct
17 Incorrect 10 ms 2580 KB Output isn't correct
18 Incorrect 11 ms 2584 KB Output isn't correct
19 Incorrect 11 ms 2584 KB Output isn't correct
20 Correct 7 ms 2572 KB Output is correct
21 Incorrect 42 ms 2860 KB Output isn't correct
22 Incorrect 41 ms 2856 KB Output isn't correct
23 Incorrect 41 ms 2856 KB Output isn't correct
24 Incorrect 42 ms 2744 KB Output isn't correct
25 Incorrect 35 ms 2852 KB Output isn't correct
26 Incorrect 42 ms 2860 KB Output isn't correct
27 Incorrect 43 ms 2864 KB Output isn't correct
28 Incorrect 42 ms 2864 KB Output isn't correct
29 Incorrect 41 ms 2812 KB Output isn't correct
30 Correct 28 ms 2856 KB Output is correct
31 Incorrect 0 ms 2392 KB Output isn't correct
32 Incorrect 1 ms 2392 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Partially correct 1 ms 2392 KB Partially correct
3 Partially correct 0 ms 2392 KB Partially correct
4 Partially correct 1 ms 2392 KB Partially correct
5 Partially correct 1 ms 2644 KB Partially correct
6 Partially correct 1 ms 2392 KB Partially correct
7 Partially correct 1 ms 2392 KB Partially correct
8 Partially correct 1 ms 2392 KB Partially correct
9 Partially correct 0 ms 2392 KB Partially correct
10 Partially correct 1 ms 2392 KB Partially correct
11 Partially correct 1 ms 2392 KB Partially correct
12 Partially correct 1 ms 2392 KB Partially correct
13 Partially correct 1 ms 2392 KB Partially correct
14 Partially correct 2 ms 2392 KB Partially correct
15 Partially correct 1 ms 2392 KB Partially correct
16 Partially correct 10 ms 2588 KB Partially correct
17 Partially correct 10 ms 2752 KB Partially correct
18 Partially correct 10 ms 2584 KB Partially correct
19 Partially correct 10 ms 2584 KB Partially correct
20 Partially correct 7 ms 2576 KB Partially correct
21 Partially correct 42 ms 2852 KB Partially correct
22 Partially correct 45 ms 2852 KB Partially correct
23 Partially correct 42 ms 2860 KB Partially correct
24 Partially correct 42 ms 2856 KB Partially correct
25 Partially correct 35 ms 2856 KB Partially correct
26 Partially correct 42 ms 2856 KB Partially correct
27 Partially correct 43 ms 3104 KB Partially correct
28 Partially correct 43 ms 2844 KB Partially correct
29 Partially correct 41 ms 2856 KB Partially correct
30 Partially correct 28 ms 2844 KB Partially correct
31 Partially correct 0 ms 2392 KB Partially correct
32 Partially correct 2 ms 2392 KB Partially correct