Submission #105976

# Submission time Handle Problem Language Result Execution time Memory
105976 2019-04-16T03:23:12 Z Hideo Gap (APIO16_gap) C++14
70 / 100
92 ms 3696 KB
#include <bits/stdc++.h>
//#include "grader.cpp"
#include "gap.h"

using namespace std;

#define ll long long
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define vi vector < int >
#define vl vector < ll >
#define pl pair < ll, ll >
#define pii pair < int, pl >
#define vii vector < pl >

const int MAXN = 1e5 + 7;
const ll INF = 1e18;

ll mn, mx, l, ans;
ll s, f, sz, r;

pl a[MAXN];

long long findGap(int T, int N){
	if (T == 1){

	}
	else {
        MinMax(0, INF, &s, &f);
        sz = (f - s - 1) / (N - 1);
        r = (f - s - 1) % (N - 1);
        a[1] = {s, s};
        a[N + 1] = {f, f};
        l = s + 1;
        for (int i = 2; i <= N; i++){
            if (r){
                r--;
                MinMax(l, l + sz, &mn, &mx);
                if (mn != -1)
                    a[i] = {mn, mx};
                else
                    a[i] = a[i - 1];
                l = l + sz + 1;
            }
            else {
                MinMax(l, l + sz - 1, &mn, &mx);
                if (mn != -1)
                    a[i] = {mn, mx};
                else
                    a[i] = a[i - 1];
                l = l + sz;
            }
            ans = max(ans, a[i].fr - a[i - 1].sc);
        }
        ans = max(ans, a[N + 1].fr - a[N].sc);

	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Incorrect 3 ms 384 KB Output isn't correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Incorrect 2 ms 384 KB Output isn't correct
5 Incorrect 2 ms 300 KB Output isn't correct
6 Incorrect 2 ms 384 KB Output isn't correct
7 Incorrect 2 ms 384 KB Output isn't correct
8 Incorrect 2 ms 384 KB Output isn't correct
9 Incorrect 2 ms 384 KB Output isn't correct
10 Incorrect 2 ms 384 KB Output isn't correct
11 Incorrect 2 ms 384 KB Output isn't correct
12 Incorrect 2 ms 384 KB Output isn't correct
13 Incorrect 2 ms 384 KB Output isn't correct
14 Incorrect 3 ms 384 KB Output isn't correct
15 Incorrect 3 ms 384 KB Output isn't correct
16 Incorrect 8 ms 1024 KB Output isn't correct
17 Incorrect 10 ms 1024 KB Output isn't correct
18 Incorrect 13 ms 1024 KB Output isn't correct
19 Incorrect 10 ms 1024 KB Output isn't correct
20 Incorrect 6 ms 640 KB Output isn't correct
21 Incorrect 42 ms 1952 KB Output isn't correct
22 Incorrect 30 ms 2048 KB Output isn't correct
23 Incorrect 28 ms 2040 KB Output isn't correct
24 Incorrect 28 ms 1964 KB Output isn't correct
25 Incorrect 20 ms 1920 KB Output isn't correct
26 Incorrect 36 ms 1912 KB Output isn't correct
27 Incorrect 36 ms 2040 KB Output isn't correct
28 Incorrect 29 ms 2048 KB Output isn't correct
29 Incorrect 28 ms 2040 KB Output isn't correct
30 Incorrect 18 ms 1792 KB Output isn't correct
31 Incorrect 2 ms 384 KB Output isn't correct
32 Incorrect 2 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 300 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 KB Output is correct
10 Correct 3 ms 384 KB Output is correct
11 Correct 3 ms 384 KB Output is correct
12 Correct 3 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 3 ms 428 KB Output is correct
15 Correct 4 ms 512 KB Output is correct
16 Correct 19 ms 1356 KB Output is correct
17 Correct 21 ms 1408 KB Output is correct
18 Correct 21 ms 1448 KB Output is correct
19 Correct 17 ms 1312 KB Output is correct
20 Correct 11 ms 1024 KB Output is correct
21 Correct 71 ms 3576 KB Output is correct
22 Correct 69 ms 3696 KB Output is correct
23 Correct 86 ms 3568 KB Output is correct
24 Correct 72 ms 3576 KB Output is correct
25 Correct 57 ms 3448 KB Output is correct
26 Correct 66 ms 3636 KB Output is correct
27 Correct 66 ms 3576 KB Output is correct
28 Correct 92 ms 3512 KB Output is correct
29 Correct 68 ms 3576 KB Output is correct
30 Correct 55 ms 3320 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 3 ms 384 KB Output is correct