답안 #942342

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
942342 2024-03-10T13:16:05 Z esomer Gym Badges (NOI22_gymbadges) C++17
100 / 100
309 ms 33616 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	int N; cin >> N;
	vector<tuple<int, int, int>> v(N, {0,0,0});
	for(int i = 0; i < N; i++){
		int X; cin >> X;
		get<0>(v[i]) += X;
		get<1>(v[i]) = X;
	}
	for(int i = 0; i < N; i++){
		int L; cin >> L;
		get<0>(v[i]) += L;
		get<2>(v[i]) = L;
	}
	sort(v.begin(), v.end());
	multiset<int> hv;
	int ans = 0;
	int lvl = 0;
	for(int i = 0; i < N; i++){
		// cout << get<0>(v[i]) << " " << get<1>(v[i]) << " " << get<2>(v[i]) << "\n";
		if(lvl <= get<2>(v[i])){
			ans++;
			lvl += get<1>(v[i]);
			hv.insert(get<1>(v[i]));
		}else{
			int mx = *hv.rbegin();
			if(mx <= get<1>(v[i])) continue;
			hv.erase(hv.find(mx));
			lvl -= mx; ans--;
			if(lvl <= get<2>(v[i])){
				ans++;
				lvl += get<1>(v[i]);
				hv.insert(get<1>(v[i]));
			}
		}
	}
	cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 113 ms 11092 KB Output is correct
2 Correct 112 ms 11288 KB Output is correct
3 Correct 133 ms 11440 KB Output is correct
4 Correct 122 ms 11044 KB Output is correct
5 Correct 119 ms 11400 KB Output is correct
6 Correct 123 ms 11928 KB Output is correct
7 Correct 121 ms 10672 KB Output is correct
8 Correct 115 ms 11492 KB Output is correct
9 Correct 135 ms 11800 KB Output is correct
10 Correct 112 ms 12372 KB Output is correct
11 Correct 138 ms 21012 KB Output is correct
12 Correct 150 ms 22840 KB Output is correct
13 Correct 168 ms 22272 KB Output is correct
14 Correct 153 ms 22676 KB Output is correct
15 Correct 149 ms 23632 KB Output is correct
16 Correct 118 ms 13904 KB Output is correct
17 Correct 120 ms 14676 KB Output is correct
18 Correct 126 ms 14928 KB Output is correct
19 Correct 114 ms 13392 KB Output is correct
20 Correct 111 ms 12116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 2 ms 604 KB Output is correct
23 Correct 2 ms 600 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 2 ms 604 KB Output is correct
27 Correct 2 ms 604 KB Output is correct
28 Correct 2 ms 464 KB Output is correct
29 Correct 2 ms 600 KB Output is correct
30 Correct 2 ms 608 KB Output is correct
31 Correct 2 ms 604 KB Output is correct
32 Correct 2 ms 604 KB Output is correct
33 Correct 2 ms 604 KB Output is correct
34 Correct 2 ms 604 KB Output is correct
35 Correct 2 ms 604 KB Output is correct
36 Correct 2 ms 668 KB Output is correct
37 Correct 2 ms 604 KB Output is correct
38 Correct 2 ms 724 KB Output is correct
39 Correct 2 ms 600 KB Output is correct
40 Correct 3 ms 604 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 2 ms 724 KB Output is correct
43 Correct 2 ms 604 KB Output is correct
44 Correct 2 ms 596 KB Output is correct
45 Correct 2 ms 604 KB Output is correct
46 Correct 2 ms 604 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 2 ms 604 KB Output is correct
49 Correct 2 ms 596 KB Output is correct
50 Correct 2 ms 604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 456 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 113 ms 11092 KB Output is correct
22 Correct 112 ms 11288 KB Output is correct
23 Correct 133 ms 11440 KB Output is correct
24 Correct 122 ms 11044 KB Output is correct
25 Correct 119 ms 11400 KB Output is correct
26 Correct 123 ms 11928 KB Output is correct
27 Correct 121 ms 10672 KB Output is correct
28 Correct 115 ms 11492 KB Output is correct
29 Correct 135 ms 11800 KB Output is correct
30 Correct 112 ms 12372 KB Output is correct
31 Correct 138 ms 21012 KB Output is correct
32 Correct 150 ms 22840 KB Output is correct
33 Correct 168 ms 22272 KB Output is correct
34 Correct 153 ms 22676 KB Output is correct
35 Correct 149 ms 23632 KB Output is correct
36 Correct 118 ms 13904 KB Output is correct
37 Correct 120 ms 14676 KB Output is correct
38 Correct 126 ms 14928 KB Output is correct
39 Correct 114 ms 13392 KB Output is correct
40 Correct 111 ms 12116 KB Output is correct
41 Correct 2 ms 604 KB Output is correct
42 Correct 2 ms 604 KB Output is correct
43 Correct 2 ms 600 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 2 ms 600 KB Output is correct
46 Correct 2 ms 604 KB Output is correct
47 Correct 2 ms 604 KB Output is correct
48 Correct 2 ms 464 KB Output is correct
49 Correct 2 ms 600 KB Output is correct
50 Correct 2 ms 608 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 2 ms 604 KB Output is correct
53 Correct 2 ms 604 KB Output is correct
54 Correct 2 ms 604 KB Output is correct
55 Correct 2 ms 604 KB Output is correct
56 Correct 2 ms 668 KB Output is correct
57 Correct 2 ms 604 KB Output is correct
58 Correct 2 ms 724 KB Output is correct
59 Correct 2 ms 600 KB Output is correct
60 Correct 3 ms 604 KB Output is correct
61 Correct 2 ms 604 KB Output is correct
62 Correct 2 ms 724 KB Output is correct
63 Correct 2 ms 604 KB Output is correct
64 Correct 2 ms 596 KB Output is correct
65 Correct 2 ms 604 KB Output is correct
66 Correct 2 ms 604 KB Output is correct
67 Correct 2 ms 604 KB Output is correct
68 Correct 2 ms 604 KB Output is correct
69 Correct 2 ms 596 KB Output is correct
70 Correct 2 ms 604 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 0 ms 348 KB Output is correct
73 Correct 114 ms 11436 KB Output is correct
74 Correct 122 ms 11348 KB Output is correct
75 Correct 115 ms 11432 KB Output is correct
76 Correct 114 ms 11312 KB Output is correct
77 Correct 138 ms 11448 KB Output is correct
78 Correct 125 ms 14600 KB Output is correct
79 Correct 126 ms 14632 KB Output is correct
80 Correct 129 ms 14484 KB Output is correct
81 Correct 127 ms 14512 KB Output is correct
82 Correct 131 ms 14508 KB Output is correct
83 Correct 164 ms 20304 KB Output is correct
84 Correct 164 ms 20052 KB Output is correct
85 Correct 161 ms 20052 KB Output is correct
86 Correct 160 ms 20264 KB Output is correct
87 Correct 165 ms 20152 KB Output is correct
88 Correct 215 ms 25628 KB Output is correct
89 Correct 237 ms 25528 KB Output is correct
90 Correct 216 ms 25424 KB Output is correct
91 Correct 201 ms 25516 KB Output is correct
92 Correct 209 ms 25620 KB Output is correct
93 Correct 245 ms 29100 KB Output is correct
94 Correct 238 ms 28948 KB Output is correct
95 Correct 255 ms 29116 KB Output is correct
96 Correct 263 ms 29012 KB Output is correct
97 Correct 266 ms 29144 KB Output is correct
98 Correct 116 ms 12080 KB Output is correct
99 Correct 117 ms 12056 KB Output is correct
100 Correct 122 ms 11948 KB Output is correct
101 Correct 297 ms 33452 KB Output is correct
102 Correct 309 ms 33616 KB Output is correct