# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
779834 | 2023-07-12T00:30:23 Z | 79brue | Bodyguards (CEOI10_bodyguards) | C++17 | 73 ms | 13100 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n, m; pair<ll, ll> a[200002]; pair<ll, ll> b[200002]; ll c[2002], d[2002]; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++) scanf("%lld %lld", &a[i].first, &a[i].second); scanf("%d", &m); for(int i=1; i<=m; i++) scanf("%lld %lld", &b[i].first, &b[i].second); sort(a+1, a+n+1); sort(b+1, b+m+1), reverse(b+1, b+m+1); { int pnt = 0; for(int i=1; i<=n; i++) for(ll j=1; j<=a[i].second; j++) c[++pnt] = a[i].first; n = pnt; pnt = 0; for(int i=1; i<=m; i++) for(ll j=1; j<=b[i].second; j++) d[++pnt] = b[i].first; m = pnt; } for(int i=1; i<=n; i++){ sort(d+1, d+m+1), reverse(d+1, d+m+1); if(!d[c[i]]){ puts("0"); return 0; } for(int j=1; j<=c[i]; j++) d[j]--; } puts("1"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 0 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 212 KB | Output is correct |
11 | Correct | 0 ms | 212 KB | Output is correct |
12 | Correct | 0 ms | 212 KB | Output is correct |
13 | Correct | 0 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 284 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 1 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 212 KB | Output is correct |
12 | Correct | 1 ms | 316 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 212 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 212 KB | Output is correct |
2 | Correct | 2 ms | 212 KB | Output is correct |
3 | Correct | 2 ms | 212 KB | Output is correct |
4 | Correct | 2 ms | 212 KB | Output is correct |
5 | Correct | 2 ms | 340 KB | Output is correct |
6 | Correct | 2 ms | 312 KB | Output is correct |
7 | Correct | 2 ms | 212 KB | Output is correct |
8 | Correct | 2 ms | 312 KB | Output is correct |
9 | Correct | 9 ms | 340 KB | Output is correct |
10 | Correct | 7 ms | 340 KB | Output is correct |
11 | Correct | 2 ms | 340 KB | Output is correct |
12 | Correct | 2 ms | 308 KB | Output is correct |
13 | Correct | 2 ms | 340 KB | Output is correct |
14 | Correct | 2 ms | 348 KB | Output is correct |
15 | Correct | 2 ms | 340 KB | Output is correct |
16 | Correct | 2 ms | 340 KB | Output is correct |
17 | Correct | 7 ms | 340 KB | Output is correct |
18 | Correct | 7 ms | 308 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 212 KB | Output is correct |
2 | Correct | 7 ms | 348 KB | Output is correct |
3 | Correct | 6 ms | 340 KB | Output is correct |
4 | Correct | 6 ms | 340 KB | Output is correct |
5 | Correct | 7 ms | 340 KB | Output is correct |
6 | Correct | 6 ms | 352 KB | Output is correct |
7 | Correct | 6 ms | 348 KB | Output is correct |
8 | Correct | 5 ms | 308 KB | Output is correct |
9 | Correct | 7 ms | 340 KB | Output is correct |
10 | Correct | 8 ms | 312 KB | Output is correct |
11 | Correct | 7 ms | 316 KB | Output is correct |
12 | Correct | 7 ms | 312 KB | Output is correct |
13 | Correct | 7 ms | 340 KB | Output is correct |
14 | Correct | 7 ms | 316 KB | Output is correct |
15 | Correct | 7 ms | 340 KB | Output is correct |
16 | Correct | 7 ms | 340 KB | Output is correct |
17 | Correct | 7 ms | 468 KB | Output is correct |
18 | Correct | 7 ms | 340 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 364 KB | Output is correct |
2 | Correct | 21 ms | 368 KB | Output is correct |
3 | Correct | 19 ms | 376 KB | Output is correct |
4 | Correct | 20 ms | 380 KB | Output is correct |
5 | Correct | 17 ms | 380 KB | Output is correct |
6 | Correct | 18 ms | 384 KB | Output is correct |
7 | Correct | 15 ms | 376 KB | Output is correct |
8 | Correct | 19 ms | 384 KB | Output is correct |
9 | Correct | 28 ms | 324 KB | Output is correct |
10 | Correct | 24 ms | 392 KB | Output is correct |
11 | Correct | 26 ms | 400 KB | Output is correct |
12 | Correct | 20 ms | 400 KB | Output is correct |
13 | Correct | 20 ms | 340 KB | Output is correct |
14 | Correct | 17 ms | 320 KB | Output is correct |
15 | Correct | 20 ms | 340 KB | Output is correct |
16 | Correct | 15 ms | 304 KB | Output is correct |
17 | Correct | 20 ms | 340 KB | Output is correct |
18 | Correct | 14 ms | 408 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 10 ms | 13040 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 13072 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 25 ms | 13056 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 41 ms | 13100 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 73 ms | 13056 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |