# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
886501 | 2023-12-12T09:03:24 Z | vjudge1 | Gym Badges (NOI22_gymbadges) | C++11 | 423 ms | 29460 KB |
#include <bits/stdc++.h> #define pb push_back #define all(aa) aa.begin(), aa.end() using namespace std; typedef long long ll; int main(){ int n; cin >> n; vector<ll> L(n), X(n); for(int i = 0; i < n; i++) cin >> X[i]; for(int i = 0; i < n; i++) cin >> L[i]; vector<pair<ll, ll>> G(n); for(int i = 0; i < n; i++){ G[i] = make_pair(L[i], X[i]); } sort(all(G)); priority_queue<ll> vals; ll score = 0, ans = 0; for(int i = 0; i < n; i++){ auto [Li, Xi] = G[i]; if(score <= Li){ vals.push(Xi); score+=Xi; ans++; } else if(vals.top() > Xi){ score -= vals.top(); vals.pop(); score += Xi; vals.push(Xi); } } cout << ans << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Incorrect | 0 ms | 348 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 300 ms | 15932 KB | Output is correct |
2 | Correct | 306 ms | 25244 KB | Output is correct |
3 | Correct | 306 ms | 25172 KB | Output is correct |
4 | Correct | 309 ms | 25240 KB | Output is correct |
5 | Correct | 423 ms | 25256 KB | Output is correct |
6 | Correct | 292 ms | 24784 KB | Output is correct |
7 | Correct | 294 ms | 23940 KB | Output is correct |
8 | Correct | 287 ms | 24352 KB | Output is correct |
9 | Correct | 285 ms | 24612 KB | Output is correct |
10 | Correct | 301 ms | 24868 KB | Output is correct |
11 | Correct | 263 ms | 25492 KB | Output is correct |
12 | Correct | 269 ms | 29460 KB | Output is correct |
13 | Correct | 262 ms | 25500 KB | Output is correct |
14 | Correct | 267 ms | 28188 KB | Output is correct |
15 | Correct | 259 ms | 27588 KB | Output is correct |
16 | Correct | 282 ms | 24780 KB | Output is correct |
17 | Correct | 278 ms | 24852 KB | Output is correct |
18 | Correct | 283 ms | 24868 KB | Output is correct |
19 | Correct | 282 ms | 24272 KB | Output is correct |
20 | Correct | 283 ms | 24344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Incorrect | 0 ms | 348 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 356 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Incorrect | 0 ms | 348 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |