답안 #1029909

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1029909 2024-07-21T13:40:26 Z KasymK Gap (APIO16_gap) C++17
0 / 100
42 ms 3664 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;
const ll INF = 1e18;
ll a[N];

ll findGap(int t, int n){
	if(t == 1){
		ll l = 0, r = INF, 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;
	MinMax(0ll, INF, &mn, &mx);
	ll d = (mx-mn-1)/(n-1);
	a[id++] = mn;
	for(ll l = mn+1; l < mx; l+=d+1){
		MinMax(l, min(l+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;
}
# 결과 실행 시간 메모리 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 0 ms 344 KB Output isn't correct
6 Incorrect 1 ms 344 KB Output isn't correct
7 Incorrect 1 ms 344 KB Output isn't correct
8 Incorrect 1 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 7 ms 856 KB Output isn't correct
17 Incorrect 9 ms 856 KB Output isn't correct
18 Incorrect 8 ms 600 KB Output isn't correct
19 Incorrect 7 ms 600 KB Output isn't correct
20 Incorrect 6 ms 600 KB Output isn't correct
21 Incorrect 29 ms 1880 KB Output isn't correct
22 Incorrect 31 ms 1768 KB Output isn't correct
23 Incorrect 38 ms 1872 KB Output isn't correct
24 Incorrect 42 ms 1908 KB Output isn't correct
25 Incorrect 24 ms 1880 KB Output isn't correct
26 Incorrect 35 ms 2020 KB Output isn't correct
27 Incorrect 34 ms 1868 KB Output isn't correct
28 Incorrect 25 ms 1880 KB Output isn't correct
29 Incorrect 27 ms 1880 KB Output isn't correct
30 Incorrect 26 ms 1856 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
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 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 1 ms 344 KB Output isn't correct
5 Incorrect 0 ms 344 KB Output isn't correct
6 Incorrect 1 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 1 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 9 ms 856 KB Output isn't correct
17 Incorrect 10 ms 856 KB Output isn't correct
18 Incorrect 10 ms 856 KB Output isn't correct
19 Incorrect 8 ms 856 KB Output isn't correct
20 Incorrect 5 ms 600 KB Output isn't correct
21 Runtime error 38 ms 3664 KB Execution killed with signal 11
22 Runtime error 36 ms 3664 KB Execution killed with signal 11
23 Runtime error 34 ms 3664 KB Execution killed with signal 11
24 Runtime error 33 ms 3612 KB Execution killed with signal 11
25 Runtime error 29 ms 3664 KB Execution killed with signal 11
26 Runtime error 41 ms 3664 KB Execution killed with signal 11
27 Runtime error 37 ms 3660 KB Execution killed with signal 11
28 Runtime error 38 ms 3560 KB Execution killed with signal 11
29 Runtime error 37 ms 3664 KB Execution killed with signal 11
30 Incorrect 27 ms 1360 KB Output isn't correct
31 Incorrect 1 ms 344 KB Output isn't correct
32 Incorrect 0 ms 344 KB Output isn't correct