Submission #886525

# Submission time Handle Problem Language Result Execution time Memory
886525 2023-12-12T09:25:17 Z vjudge1 Gym Badges (NOI22_gymbadges) C++17
24 / 100
309 ms 4436 KB
#include <bits/stdc++.h>
using namespace std;
#define tol(bi) (1ll<<((int)(bi)))
int main(){
	int n;
	cin>>n;
	vector<pair<int,int>> arr(n);
	for (int i = 0; i < n; ++i)
	{
		cin>>arr[i].second;
	}
	for (int i = 0; i < n; ++i)
	{
		cin>>arr[i].first;
	}
	sort(arr.begin(), arr.end(), [&](pair<int,int> a, pair<int,int> b){
		return (a.first+a.second)<(b.first+b.second);
	});
	int ans = 0;
	int somma = 0;
	for (int i = 0; i < n; i++){
		if (somma>arr[i].first) continue;
		somma+=arr[i].second;
		ans++;
	}
	cout<<ans<<endl;
}
# Verdict Execution time Memory 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 344 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 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 580 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 297 ms 4332 KB Output is correct
2 Correct 309 ms 4332 KB Output is correct
3 Correct 294 ms 4188 KB Output is correct
4 Correct 293 ms 4328 KB Output is correct
5 Correct 298 ms 4188 KB Output is correct
6 Correct 273 ms 4188 KB Output is correct
7 Correct 271 ms 4436 KB Output is correct
8 Correct 275 ms 4328 KB Output is correct
9 Correct 278 ms 4332 KB Output is correct
10 Correct 271 ms 4188 KB Output is correct
11 Correct 246 ms 4188 KB Output is correct
12 Correct 255 ms 4336 KB Output is correct
13 Correct 246 ms 4184 KB Output is correct
14 Correct 246 ms 4336 KB Output is correct
15 Correct 256 ms 4328 KB Output is correct
16 Correct 263 ms 4184 KB Output is correct
17 Correct 261 ms 4188 KB Output is correct
18 Correct 261 ms 4188 KB Output is correct
19 Correct 262 ms 4328 KB Output is correct
20 Correct 267 ms 4328 KB Output is correct
# Verdict Execution time Memory 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 344 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 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 580 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Incorrect 3 ms 348 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory 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 344 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 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 580 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 297 ms 4332 KB Output is correct
22 Correct 309 ms 4332 KB Output is correct
23 Correct 294 ms 4188 KB Output is correct
24 Correct 293 ms 4328 KB Output is correct
25 Correct 298 ms 4188 KB Output is correct
26 Correct 273 ms 4188 KB Output is correct
27 Correct 271 ms 4436 KB Output is correct
28 Correct 275 ms 4328 KB Output is correct
29 Correct 278 ms 4332 KB Output is correct
30 Correct 271 ms 4188 KB Output is correct
31 Correct 246 ms 4188 KB Output is correct
32 Correct 255 ms 4336 KB Output is correct
33 Correct 246 ms 4184 KB Output is correct
34 Correct 246 ms 4336 KB Output is correct
35 Correct 256 ms 4328 KB Output is correct
36 Correct 263 ms 4184 KB Output is correct
37 Correct 261 ms 4188 KB Output is correct
38 Correct 261 ms 4188 KB Output is correct
39 Correct 262 ms 4328 KB Output is correct
40 Correct 267 ms 4328 KB Output is correct
41 Incorrect 3 ms 348 KB Output isn't correct
42 Halted 0 ms 0 KB -