# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
39805 |
2018-01-19T08:14:10 Z |
14kg |
Gap (APIO16_gap) |
C++11 |
|
2000 ms |
9052 KB |
#include "gap.h"
#include <set>
#define NUM_MAX 1000000000000000000
#define max2(x,y) (x>y?x:y)
using namespace std;
int n;
set<long long> S;
long long f1() {
long long l = 0, r = NUM_MAX;
long long t1, t2, res = 0;
while (l <= r) {
MinMax(l, r, &t1, &t2);
if (t1 < 0) break;
S.insert(l = t1), S.insert(r = t2);
l++, r--;
if (S.size() == n) break;
}
t1 = NUM_MAX;
for (auto i : S) res = max2(res, i - t1), t1 = i;
return res;
}
long long f2() {
long long S, E, len, res, t1, t2, path = NUM_MAX;
MinMax(0, NUM_MAX, &S, &E);
res = len = (E - S) / (n - 1) + ((E - S) % (n - 1) ? 1 : 0);
for (int s = S; s <= E; s += len) {
MinMax(s, s + len - 1, &t1, &t2);
if (t1 < 0) continue;
res = max2(res, t1 - path), path = t2;
} return res;
}
long long findGap(int T, int _n) {
n = _n;
if (T == 1) return f1();
else return f2();
}
Compilation message
gap.cpp: In function 'long long int f1()':
gap.cpp:20:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (S.size() == n) break;
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4300 KB |
Output is correct |
2 |
Correct |
0 ms |
4300 KB |
Output is correct |
3 |
Correct |
0 ms |
4300 KB |
Output is correct |
4 |
Correct |
0 ms |
4300 KB |
Output is correct |
5 |
Correct |
0 ms |
4300 KB |
Output is correct |
6 |
Correct |
0 ms |
4300 KB |
Output is correct |
7 |
Correct |
0 ms |
4300 KB |
Output is correct |
8 |
Correct |
0 ms |
4300 KB |
Output is correct |
9 |
Correct |
0 ms |
4300 KB |
Output is correct |
10 |
Correct |
0 ms |
4300 KB |
Output is correct |
11 |
Correct |
1 ms |
4432 KB |
Output is correct |
12 |
Correct |
1 ms |
4432 KB |
Output is correct |
13 |
Correct |
1 ms |
4432 KB |
Output is correct |
14 |
Correct |
1 ms |
4432 KB |
Output is correct |
15 |
Correct |
1 ms |
4432 KB |
Output is correct |
16 |
Correct |
22 ms |
5488 KB |
Output is correct |
17 |
Correct |
16 ms |
5488 KB |
Output is correct |
18 |
Correct |
11 ms |
5488 KB |
Output is correct |
19 |
Correct |
17 ms |
5488 KB |
Output is correct |
20 |
Correct |
17 ms |
5488 KB |
Output is correct |
21 |
Correct |
75 ms |
9052 KB |
Output is correct |
22 |
Correct |
80 ms |
9052 KB |
Output is correct |
23 |
Correct |
88 ms |
9052 KB |
Output is correct |
24 |
Correct |
84 ms |
9052 KB |
Output is correct |
25 |
Correct |
75 ms |
9052 KB |
Output is correct |
26 |
Correct |
91 ms |
9052 KB |
Output is correct |
27 |
Correct |
104 ms |
9052 KB |
Output is correct |
28 |
Correct |
79 ms |
9052 KB |
Output is correct |
29 |
Correct |
95 ms |
9052 KB |
Output is correct |
30 |
Correct |
75 ms |
9052 KB |
Output is correct |
31 |
Correct |
0 ms |
4300 KB |
Output is correct |
32 |
Correct |
0 ms |
4300 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
2 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
3 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
4 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
5 |
Partially correct |
0 ms |
4300 KB |
Partially correct |
6 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
7 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
8 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
9 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
10 |
Correct |
0 ms |
4300 KB |
Output is correct |
11 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
12 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
13 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
14 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
15 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
16 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
17 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
18 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
19 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
20 |
Correct |
8 ms |
4300 KB |
Output is correct |
21 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
22 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
23 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
24 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
25 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
26 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
27 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
28 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
29 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
30 |
Correct |
36 ms |
4300 KB |
Output is correct |
31 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |
32 |
Execution timed out |
2000 ms |
4300 KB |
Execution timed out |