Submission #1029911

# Submission time Handle Problem Language Result Execution time Memory
1029911 2024-07-21T13:44:17 Z KasymK Gap (APIO16_gap) C++17
0 / 100
43 ms 3696 KB
#include "bits/stdc++.h"
#include "gap.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define ll long long
#define pb push_back
#define pii pair<int, int>
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
const int MOD = 1e9+7;
const int N = 1e5+5;
ll a[N];

ll findGap(int t, int n){
	if(t == 1){
		ll l = 0, r = 1e18, id = 0, mn, mx, ans = 0;
        for(int i = 0; i < (n+1)/2; ++i){
            MinMax(l, r, &mn, &mx);
            a[id++] = mn, a[id++] = mx, l = mn+1, r = mx-1;
        }
        sort(a, a+n);
        for(int i = 0; i < n-1; ++i)
        	umin(ans, a[i+1]-a[i]);
        return ans;
    }
    ll a_, b_, mn, mx, id = 0, l = 0, r = 1e18;
	MinMax(l, r, &mn, &mx);
	ll d = (mx-mn-1)/(n-1);
	a[id++] = mn;
	for(ll i = mn+1; i < mx; i+=d+1){
		MinMax(i, min(i+d, mx-1), &a_, &b_);
		if(a_ != -1)	
			a[id++] = a_, a[id++] = b_;
	}
	a[id++] = mx;
	ll ans = 0;
	for(int i = 0; i < n-1; ++i)
		umin(ans, a[i+1]-a[i]);
	return ans;
}
# 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 1 ms 344 KB Output isn't correct
4 Incorrect 0 ms 344 KB Output isn't correct
5 Incorrect 1 ms 512 KB Output isn't correct
6 Incorrect 1 ms 344 KB Output isn't correct
7 Incorrect 0 ms 344 KB Output isn't correct
8 Incorrect 1 ms 344 KB Output isn't correct
9 Incorrect 0 ms 344 KB Output isn't correct
10 Incorrect 1 ms 512 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 9 ms 852 KB Output isn't correct
17 Incorrect 7 ms 600 KB Output isn't correct
18 Incorrect 8 ms 600 KB Output isn't correct
19 Incorrect 8 ms 600 KB Output isn't correct
20 Incorrect 5 ms 600 KB Output isn't correct
21 Incorrect 36 ms 1824 KB Output isn't correct
22 Incorrect 30 ms 1900 KB Output isn't correct
23 Incorrect 26 ms 1880 KB Output isn't correct
24 Incorrect 26 ms 1880 KB Output isn't correct
25 Incorrect 22 ms 1880 KB Output isn't correct
26 Incorrect 26 ms 1800 KB Output isn't correct
27 Incorrect 25 ms 1880 KB Output isn't correct
28 Incorrect 31 ms 2020 KB Output isn't correct
29 Incorrect 24 ms 1880 KB Output isn't correct
30 Incorrect 21 ms 1876 KB Output isn't correct
31 Incorrect 0 ms 344 KB Output isn't correct
32 Incorrect 1 ms 344 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 1 ms 344 KB Output isn't correct
8 Incorrect 0 ms 344 KB Output isn't correct
9 Incorrect 1 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 13 ms 904 KB Output isn't correct
17 Incorrect 8 ms 856 KB Output isn't correct
18 Incorrect 9 ms 856 KB Output isn't correct
19 Incorrect 11 ms 856 KB Output isn't correct
20 Incorrect 5 ms 600 KB Output isn't correct
21 Runtime error 38 ms 3668 KB Execution killed with signal 11
22 Runtime error 34 ms 3664 KB Execution killed with signal 11
23 Runtime error 36 ms 3576 KB Execution killed with signal 11
24 Runtime error 43 ms 3620 KB Execution killed with signal 11
25 Runtime error 27 ms 3504 KB Execution killed with signal 11
26 Runtime error 34 ms 3664 KB Execution killed with signal 11
27 Runtime error 40 ms 3664 KB Execution killed with signal 11
28 Runtime error 34 ms 3696 KB Execution killed with signal 11
29 Runtime error 36 ms 3608 KB Execution killed with signal 11
30 Incorrect 26 ms 1112 KB Output isn't correct
31 Incorrect 0 ms 344 KB Output isn't correct
32 Incorrect 1 ms 344 KB Output isn't correct