답안 #465051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
465051 2021-08-15T01:28:32 Z deinfreund Global Warming (CEOI18_glo) C++14
100 / 100
314 ms 15524 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n, num, d;
  cin >> n >> d;
  map<int, int> blub, fred;
  blub[-d] = fred[-d] = 0;
  for (int i = 0; i < n; i++) {
    cin >> num;
    fred[num] = max(prev(blub.lower_bound(num + d))->second + 1, prev(fred.lower_bound(num))->second + 1);
    {
      auto it = fred.find(num);
      int val = it->second;
      auto nextit = next(it);
      while(nextit != fred.end() && nextit->second < val) {
	fred.erase(nextit);
	nextit = next(fred.find(num));
      }
    }
    { 
      blub[num] = prev(blub.lower_bound(num))->second + 1;
      auto it = blub.find(num);
      int val = it->second;
      auto nextit = next(it);
      while(nextit != blub.end() && nextit->second < val) {
	blub.erase(nextit);
	nextit = next(blub.find(num));
      }
    }
    //cerr << fred.rbegin()->second << ", " <<blub.rbegin()->second << "\n";
  }
  cout << max(fred.rbegin()->second, blub.rbegin()->second) << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 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 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 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 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 2 ms 204 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 2 ms 204 KB Output is correct
22 Correct 2 ms 204 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 284 ms 432 KB Output is correct
2 Correct 292 ms 328 KB Output is correct
3 Correct 286 ms 332 KB Output is correct
4 Correct 285 ms 512 KB Output is correct
5 Correct 216 ms 9684 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 332 KB Output is correct
2 Correct 67 ms 804 KB Output is correct
3 Correct 68 ms 820 KB Output is correct
4 Correct 45 ms 2884 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 62 ms 2844 KB Output is correct
7 Correct 65 ms 2300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 129 ms 316 KB Output is correct
2 Correct 129 ms 456 KB Output is correct
3 Correct 268 ms 432 KB Output is correct
4 Correct 145 ms 4880 KB Output is correct
5 Correct 131 ms 4848 KB Output is correct
6 Correct 271 ms 13772 KB Output is correct
7 Correct 301 ms 9156 KB Output is correct
8 Correct 131 ms 3380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1 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 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 2 ms 204 KB Output is correct
20 Correct 2 ms 204 KB Output is correct
21 Correct 2 ms 204 KB Output is correct
22 Correct 2 ms 204 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 284 ms 432 KB Output is correct
28 Correct 292 ms 328 KB Output is correct
29 Correct 286 ms 332 KB Output is correct
30 Correct 285 ms 512 KB Output is correct
31 Correct 216 ms 9684 KB Output is correct
32 Correct 68 ms 332 KB Output is correct
33 Correct 67 ms 804 KB Output is correct
34 Correct 68 ms 820 KB Output is correct
35 Correct 45 ms 2884 KB Output is correct
36 Correct 0 ms 204 KB Output is correct
37 Correct 62 ms 2844 KB Output is correct
38 Correct 65 ms 2300 KB Output is correct
39 Correct 129 ms 316 KB Output is correct
40 Correct 129 ms 456 KB Output is correct
41 Correct 268 ms 432 KB Output is correct
42 Correct 145 ms 4880 KB Output is correct
43 Correct 131 ms 4848 KB Output is correct
44 Correct 271 ms 13772 KB Output is correct
45 Correct 301 ms 9156 KB Output is correct
46 Correct 131 ms 3380 KB Output is correct
47 Correct 139 ms 1324 KB Output is correct
48 Correct 144 ms 1348 KB Output is correct
49 Correct 286 ms 2336 KB Output is correct
50 Correct 222 ms 10820 KB Output is correct
51 Correct 209 ms 10444 KB Output is correct
52 Correct 293 ms 10820 KB Output is correct
53 Correct 292 ms 15524 KB Output is correct
54 Correct 314 ms 11592 KB Output is correct
55 Correct 294 ms 8772 KB Output is correct