# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
242149 |
2020-06-27T01:58:07 Z |
syy |
Gap (APIO16_gap) |
C++17 |
|
81 ms |
1168 KB |
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define all(v) v.begin(), v.end()
#define disc(v) sort(all(v)); v.resize(unique(all(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll findGap(int t, int n) {
ll l, r; MinMax(0, 1e18, &l, &r);
if (t == 1) {
ll ans = 0;
FOR(i, 1, (n+1)/2-1) {
ll x, y; MinMax(l+1, r-1, &x, &y);
ans = max({ans, r - y, x-l});
l = x, r = y;
}
return max(ans, r-l);
} else {
ll gap = (r-l-1+n)/(n-1), pre = l, ans = 0;
for (ll i = l+1; i < r-1; i += gap) {
ll x, y; MinMax(i, min(i+gap-1, r-1), &x, &y);
if (x == -1) continue;
if (pre != -1) ans = max(ans, x - pre);
pre = y;
}
return max(ans, r - pre);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
4 ms |
384 KB |
Output is correct |
9 |
Correct |
4 ms |
384 KB |
Output is correct |
10 |
Correct |
4 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
17 ms |
512 KB |
Output is correct |
17 |
Correct |
16 ms |
564 KB |
Output is correct |
18 |
Correct |
16 ms |
512 KB |
Output is correct |
19 |
Correct |
16 ms |
512 KB |
Output is correct |
20 |
Correct |
12 ms |
512 KB |
Output is correct |
21 |
Correct |
54 ms |
1144 KB |
Output is correct |
22 |
Correct |
58 ms |
1144 KB |
Output is correct |
23 |
Correct |
61 ms |
1056 KB |
Output is correct |
24 |
Correct |
53 ms |
1144 KB |
Output is correct |
25 |
Correct |
45 ms |
1144 KB |
Output is correct |
26 |
Correct |
54 ms |
1148 KB |
Output is correct |
27 |
Correct |
53 ms |
1144 KB |
Output is correct |
28 |
Correct |
59 ms |
1076 KB |
Output is correct |
29 |
Correct |
51 ms |
1148 KB |
Output is correct |
30 |
Correct |
38 ms |
1168 KB |
Output is correct |
31 |
Correct |
4 ms |
384 KB |
Output is correct |
32 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
4 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
19 ms |
512 KB |
Output is correct |
17 |
Correct |
20 ms |
512 KB |
Output is correct |
18 |
Correct |
20 ms |
512 KB |
Output is correct |
19 |
Correct |
19 ms |
512 KB |
Output is correct |
20 |
Correct |
12 ms |
512 KB |
Output is correct |
21 |
Correct |
68 ms |
1044 KB |
Output is correct |
22 |
Correct |
69 ms |
1144 KB |
Output is correct |
23 |
Correct |
81 ms |
1148 KB |
Output is correct |
24 |
Correct |
70 ms |
1076 KB |
Output is correct |
25 |
Correct |
61 ms |
1164 KB |
Output is correct |
26 |
Correct |
69 ms |
1148 KB |
Output is correct |
27 |
Correct |
68 ms |
1160 KB |
Output is correct |
28 |
Correct |
70 ms |
1144 KB |
Output is correct |
29 |
Correct |
69 ms |
1124 KB |
Output is correct |
30 |
Correct |
43 ms |
1144 KB |
Output is correct |
31 |
Correct |
4 ms |
384 KB |
Output is correct |
32 |
Correct |
5 ms |
384 KB |
Output is correct |