Submission #92003

# Submission time Handle Problem Language Result Execution time Memory
92003 2018-12-31T23:57:03 Z updown1 Gap (APIO16_gap) C++17
30 / 100
97 ms 6008 KB
/*
https://codeforces.com/blog/entry/44657?#comment-293060
*/
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 2, N)
#define ffj For(j, 0, N)
#define ffa ffi ffj
#define ss <<" "<<
#define c <<" : "<<
#define w cout
#define e endl//"\n"
#define pb push_back
#define mp make_pair
#define a first
#define b second
//#define int ll
const int MAXN=100000;
///500,000,000
long long findGap(int T, int N) {
    if (T == 1) {
        ll ans[N], l = 0, r = N-1, mn, mx;
        while (r >= l) {
            if (l == 0) MinMax(0, 1e18, &mn, &mx);
            else if (ans[l-1]+1 <= ans[r+1]-1) MinMax(ans[l-1]+1, ans[r+1]-1, &mn, &mx);
            ans[l] = mn; ans[r] = mx;
            l++; r--;
        }
        ll ret = 0;
        For (i, 1, N) ret = max(ret, ans[i] - ans[i-1]);
        return ret;
    }
    ll l, r, mn, mx;
    MinMax(0, 1e18, &l, &r);
    set<ll> vals; vals.insert(l); vals.insert(r);
    For (i, 0, N-1) if (l+((i+1)*(r-l))/(N-1) >= l+(i*(r-l))/(N-1)+1) {
        MinMax(l+(i*(r-l))/(N-1)+1, l+((i+1)*(r-l))/(N-1), &mn, &mx); vals.insert(mn); vals.insert(mx);
    }
    ll prev = l;
    ll ret = 0;
    for (ll i: vals) {
        if (i == -1) continue;
        ret = max(ret, i-prev);
        prev = i;
    }
	return ret;
}

# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 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 376 KB Output is correct
5 Correct 2 ms 380 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 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 12 ms 888 KB Output is correct
17 Correct 13 ms 880 KB Output is correct
18 Correct 13 ms 888 KB Output is correct
19 Correct 13 ms 896 KB Output is correct
20 Correct 10 ms 888 KB Output is correct
21 Correct 46 ms 2024 KB Output is correct
22 Correct 45 ms 2164 KB Output is correct
23 Correct 45 ms 2040 KB Output is correct
24 Correct 45 ms 2040 KB Output is correct
25 Correct 39 ms 2040 KB Output is correct
26 Correct 46 ms 2040 KB Output is correct
27 Correct 45 ms 2040 KB Output is correct
28 Correct 45 ms 2040 KB Output is correct
29 Correct 45 ms 2040 KB Output is correct
30 Correct 34 ms 2040 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 256 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Incorrect 2 ms 376 KB Output isn't correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Correct 2 ms 376 KB Output is correct
11 Incorrect 2 ms 376 KB Output isn't correct
12 Incorrect 2 ms 376 KB Output isn't correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Incorrect 2 ms 376 KB Output isn't correct
15 Correct 2 ms 376 KB Output is correct
16 Incorrect 11 ms 760 KB Output isn't correct
17 Incorrect 12 ms 800 KB Output isn't correct
18 Incorrect 11 ms 760 KB Output isn't correct
19 Incorrect 12 ms 760 KB Output isn't correct
20 Correct 9 ms 632 KB Output is correct
21 Incorrect 42 ms 1436 KB Output isn't correct
22 Incorrect 42 ms 1400 KB Output isn't correct
23 Incorrect 42 ms 1400 KB Output isn't correct
24 Incorrect 43 ms 1400 KB Output isn't correct
25 Correct 97 ms 6008 KB Output is correct
26 Incorrect 42 ms 1368 KB Output isn't correct
27 Incorrect 42 ms 1448 KB Output isn't correct
28 Incorrect 42 ms 1424 KB Output isn't correct
29 Incorrect 42 ms 1400 KB Output isn't correct
30 Correct 41 ms 2168 KB Output is correct
31 Incorrect 2 ms 376 KB Output isn't correct
32 Incorrect 2 ms 376 KB Output isn't correct