Submission #644052

# Submission time Handle Problem Language Result Execution time Memory
644052 2022-09-23T16:12:54 Z ymm Money (IZhO17_money) C++17
100 / 100
1071 ms 54232 KB
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

int main()
{
	cin.tie(0) -> sync_with_stdio(false);
	int n;
	cin >> n;
	set<int> s;
	auto it = s.end();
	int ans = 1;
	int lst = -1;
	Loop (i,0,n) {
		int x;
		cin >> x;
		auto it2 = s.lower_bound(x);
		auto it3 = s.upper_bound(x);
		if (x < lst || (it != it2 && it != it3)) {
			it = it3;
			++ans;
		}
		s.insert(x);
		lst = x;
	}
	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 316 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 316 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 316 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 0 ms 316 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 320 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 316 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 0 ms 316 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 1 ms 320 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 50 ms 3488 KB Output is correct
40 Correct 89 ms 5544 KB Output is correct
41 Correct 39 ms 2864 KB Output is correct
42 Correct 39 ms 2604 KB Output is correct
43 Correct 29 ms 1968 KB Output is correct
44 Correct 111 ms 6948 KB Output is correct
45 Correct 99 ms 6960 KB Output is correct
46 Correct 107 ms 7080 KB Output is correct
47 Correct 94 ms 7076 KB Output is correct
48 Correct 98 ms 7076 KB Output is correct
49 Correct 442 ms 25612 KB Output is correct
50 Correct 475 ms 25476 KB Output is correct
51 Correct 449 ms 25584 KB Output is correct
52 Correct 448 ms 25568 KB Output is correct
53 Correct 507 ms 25600 KB Output is correct
54 Correct 449 ms 25420 KB Output is correct
55 Correct 1050 ms 54072 KB Output is correct
56 Correct 1056 ms 53932 KB Output is correct
57 Correct 1034 ms 54232 KB Output is correct
58 Correct 1014 ms 54160 KB Output is correct
59 Correct 1043 ms 54008 KB Output is correct
60 Correct 1071 ms 54092 KB Output is correct
61 Correct 1066 ms 53924 KB Output is correct
62 Correct 1038 ms 54008 KB Output is correct