Submission #931448

# Submission time Handle Problem Language Result Execution time Memory
931448 2024-02-21T20:13:08 Z vjudge1 Gym Badges (NOI22_gymbadges) C++17
24 / 100
118 ms 25536 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int N = 5e5+5;

int n, x[N], l[N];
pair<int, int> s[N];

signed main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> l[i];
  }
  for (int i = 0; i < n; i++) {
    s[i] = make_pair(x[i]+l[i], i);
  }
  sort(s, s+n);

  int ans = 0;
  int lvl = 0;
  for (int i = 0; i < n; i++) {
    int idx = s[i].second;
    if (lvl <= l[idx]) {
      ans++;
      lvl += x[idx];
    }
  }
  cout << ans << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4556 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4452 KB Output is correct
12 Correct 2 ms 4444 KB Output is correct
13 Correct 1 ms 4560 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 113 ms 25308 KB Output is correct
2 Correct 118 ms 25176 KB Output is correct
3 Correct 112 ms 25112 KB Output is correct
4 Correct 117 ms 25536 KB Output is correct
5 Correct 111 ms 25244 KB Output is correct
6 Correct 108 ms 24220 KB Output is correct
7 Correct 105 ms 23828 KB Output is correct
8 Correct 110 ms 24240 KB Output is correct
9 Correct 108 ms 24328 KB Output is correct
10 Correct 108 ms 24248 KB Output is correct
11 Correct 110 ms 23124 KB Output is correct
12 Correct 118 ms 23348 KB Output is correct
13 Correct 114 ms 23124 KB Output is correct
14 Correct 110 ms 23160 KB Output is correct
15 Correct 112 ms 23376 KB Output is correct
16 Correct 113 ms 23860 KB Output is correct
17 Correct 114 ms 23640 KB Output is correct
18 Correct 113 ms 23632 KB Output is correct
19 Correct 116 ms 23636 KB Output is correct
20 Correct 118 ms 23772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4556 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4452 KB Output is correct
12 Correct 2 ms 4444 KB Output is correct
13 Correct 1 ms 4560 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Incorrect 2 ms 4700 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 1 ms 4444 KB Output is correct
5 Correct 1 ms 4444 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4556 KB Output is correct
8 Correct 1 ms 4440 KB Output is correct
9 Correct 1 ms 4444 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
11 Correct 1 ms 4452 KB Output is correct
12 Correct 2 ms 4444 KB Output is correct
13 Correct 1 ms 4560 KB Output is correct
14 Correct 1 ms 4444 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4444 KB Output is correct
18 Correct 1 ms 4444 KB Output is correct
19 Correct 1 ms 4444 KB Output is correct
20 Correct 1 ms 4444 KB Output is correct
21 Correct 113 ms 25308 KB Output is correct
22 Correct 118 ms 25176 KB Output is correct
23 Correct 112 ms 25112 KB Output is correct
24 Correct 117 ms 25536 KB Output is correct
25 Correct 111 ms 25244 KB Output is correct
26 Correct 108 ms 24220 KB Output is correct
27 Correct 105 ms 23828 KB Output is correct
28 Correct 110 ms 24240 KB Output is correct
29 Correct 108 ms 24328 KB Output is correct
30 Correct 108 ms 24248 KB Output is correct
31 Correct 110 ms 23124 KB Output is correct
32 Correct 118 ms 23348 KB Output is correct
33 Correct 114 ms 23124 KB Output is correct
34 Correct 110 ms 23160 KB Output is correct
35 Correct 112 ms 23376 KB Output is correct
36 Correct 113 ms 23860 KB Output is correct
37 Correct 114 ms 23640 KB Output is correct
38 Correct 113 ms 23632 KB Output is correct
39 Correct 116 ms 23636 KB Output is correct
40 Correct 118 ms 23772 KB Output is correct
41 Incorrect 2 ms 4700 KB Output isn't correct
42 Halted 0 ms 0 KB -