# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
476510 | 2021-09-27T12:46:52 Z | RambaXGorilla | Global Warming (CEOI18_glo) | C++17 | 86 ms | 5360 KB |
#include<cstdio> #include<climits> #include<algorithm> using namespace std; int N, X; int temps[200010]; int incSubs[200010]; int decSubs[200010]; int lengths[200010]; int main(){ scanf("%d%d",&N,&X); for(int i = 0;i < N;i++){ scanf("%d",&temps[i]); } fill(incSubs, incSubs + N, INT_MAX); for(int i = 0;i < N;i++){ int pos = lower_bound(incSubs, incSubs + N, temps[i]) - incSubs; incSubs[pos] = temps[i]; lengths[i] = pos + 1; } int longest = 0; fill(decSubs, decSubs + N, INT_MAX); for(int i = N - 1;i > -1;i--){ int pos1 = lower_bound(decSubs, decSubs + N, X - temps[i]) - decSubs; longest = max(longest, lengths[i] + pos1); int pos2 = lower_bound(decSubs, decSubs + N, -temps[i]) - decSubs; decSubs[pos2] = -temps[i]; } printf("%d",longest); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 288 KB | Output is correct |
3 | Correct | 0 ms | 284 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 288 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 288 KB | Output is correct |
10 | Correct | 0 ms | 292 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 288 KB | Output is correct |
3 | Correct | 0 ms | 284 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 288 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 288 KB | Output is correct |
10 | Correct | 0 ms | 292 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Correct | 0 ms | 204 KB | Output is correct |
18 | Correct | 0 ms | 284 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 288 KB | Output is correct |
3 | Correct | 0 ms | 284 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 288 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 288 KB | Output is correct |
10 | Correct | 0 ms | 292 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Correct | 0 ms | 204 KB | Output is correct |
18 | Correct | 0 ms | 284 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 1 ms | 204 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 1 ms | 204 KB | Output is correct |
26 | Correct | 1 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 73 ms | 5360 KB | Output is correct |
2 | Correct | 69 ms | 5272 KB | Output is correct |
3 | Correct | 69 ms | 5316 KB | Output is correct |
4 | Correct | 86 ms | 5308 KB | Output is correct |
5 | Correct | 51 ms | 4492 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 1520 KB | Output is correct |
2 | Correct | 15 ms | 1612 KB | Output is correct |
3 | Correct | 22 ms | 1444 KB | Output is correct |
4 | Correct | 13 ms | 1272 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
6 | Correct | 14 ms | 1408 KB | Output is correct |
7 | Correct | 14 ms | 1500 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 31 ms | 2736 KB | Output is correct |
2 | Correct | 32 ms | 2756 KB | Output is correct |
3 | Correct | 65 ms | 5316 KB | Output is correct |
4 | Correct | 54 ms | 4544 KB | Output is correct |
5 | Correct | 27 ms | 2408 KB | Output is correct |
6 | Correct | 46 ms | 4440 KB | Output is correct |
7 | Correct | 49 ms | 5052 KB | Output is correct |
8 | Correct | 27 ms | 2756 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 288 KB | Output is correct |
3 | Correct | 0 ms | 284 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 288 KB | Output is correct |
6 | Correct | 0 ms | 204 KB | Output is correct |
7 | Correct | 0 ms | 204 KB | Output is correct |
8 | Correct | 0 ms | 204 KB | Output is correct |
9 | Correct | 0 ms | 288 KB | Output is correct |
10 | Correct | 0 ms | 292 KB | Output is correct |
11 | Correct | 0 ms | 204 KB | Output is correct |
12 | Correct | 0 ms | 204 KB | Output is correct |
13 | Correct | 0 ms | 204 KB | Output is correct |
14 | Correct | 0 ms | 204 KB | Output is correct |
15 | Correct | 1 ms | 204 KB | Output is correct |
16 | Correct | 0 ms | 204 KB | Output is correct |
17 | Correct | 0 ms | 204 KB | Output is correct |
18 | Correct | 0 ms | 284 KB | Output is correct |
19 | Correct | 1 ms | 204 KB | Output is correct |
20 | Correct | 1 ms | 204 KB | Output is correct |
21 | Correct | 1 ms | 204 KB | Output is correct |
22 | Correct | 1 ms | 204 KB | Output is correct |
23 | Correct | 1 ms | 204 KB | Output is correct |
24 | Correct | 1 ms | 204 KB | Output is correct |
25 | Correct | 1 ms | 204 KB | Output is correct |
26 | Correct | 1 ms | 204 KB | Output is correct |
27 | Correct | 73 ms | 5360 KB | Output is correct |
28 | Correct | 69 ms | 5272 KB | Output is correct |
29 | Correct | 69 ms | 5316 KB | Output is correct |
30 | Correct | 86 ms | 5308 KB | Output is correct |
31 | Correct | 51 ms | 4492 KB | Output is correct |
32 | Correct | 16 ms | 1520 KB | Output is correct |
33 | Correct | 15 ms | 1612 KB | Output is correct |
34 | Correct | 22 ms | 1444 KB | Output is correct |
35 | Correct | 13 ms | 1272 KB | Output is correct |
36 | Correct | 0 ms | 204 KB | Output is correct |
37 | Correct | 14 ms | 1408 KB | Output is correct |
38 | Correct | 14 ms | 1500 KB | Output is correct |
39 | Correct | 31 ms | 2736 KB | Output is correct |
40 | Correct | 32 ms | 2756 KB | Output is correct |
41 | Correct | 65 ms | 5316 KB | Output is correct |
42 | Correct | 54 ms | 4544 KB | Output is correct |
43 | Correct | 27 ms | 2408 KB | Output is correct |
44 | Correct | 46 ms | 4440 KB | Output is correct |
45 | Correct | 49 ms | 5052 KB | Output is correct |
46 | Correct | 27 ms | 2756 KB | Output is correct |
47 | Correct | 33 ms | 2800 KB | Output is correct |
48 | Correct | 32 ms | 2708 KB | Output is correct |
49 | Correct | 68 ms | 5316 KB | Output is correct |
50 | Correct | 52 ms | 4544 KB | Output is correct |
51 | Correct | 41 ms | 3472 KB | Output is correct |
52 | Correct | 58 ms | 4676 KB | Output is correct |
53 | Correct | 49 ms | 4548 KB | Output is correct |
54 | Correct | 55 ms | 5316 KB | Output is correct |
55 | Correct | 60 ms | 5344 KB | Output is correct |