Submission #942334

# Submission time Handle Problem Language Result Execution time Memory
942334 2024-03-10T13:04:10 Z vjudge1 Gym Badges (NOI22_gymbadges) C++17
9 / 100
217 ms 23664 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();
			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";
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 146 ms 11164 KB Output is correct
2 Correct 147 ms 11164 KB Output is correct
3 Correct 148 ms 11180 KB Output is correct
4 Correct 148 ms 11088 KB Output is correct
5 Correct 175 ms 11284 KB Output is correct
6 Correct 187 ms 11680 KB Output is correct
7 Correct 145 ms 10576 KB Output is correct
8 Correct 188 ms 11248 KB Output is correct
9 Correct 188 ms 11552 KB Output is correct
10 Correct 188 ms 11944 KB Output is correct
11 Correct 196 ms 20560 KB Output is correct
12 Correct 203 ms 22740 KB Output is correct
13 Correct 196 ms 22028 KB Output is correct
14 Correct 197 ms 22500 KB Output is correct
15 Correct 217 ms 23664 KB Output is correct
16 Correct 195 ms 13652 KB Output is correct
17 Correct 199 ms 14372 KB Output is correct
18 Correct 205 ms 14768 KB Output is correct
19 Correct 196 ms 12956 KB Output is correct
20 Correct 190 ms 11932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -