Submission #778956

# Submission time Handle Problem Language Result Execution time Memory
778956 2023-07-11T05:18:56 Z 이동현(#10002) Bodyguards (CEOI10_bodyguards) C++17
50 / 100
1000 ms 48736 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define int long long
using namespace std;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int r, c;
    cin >> r;
    vector<vector<int>> a(r, vector<int>(2));
    for(int i = 0; i < r; ++i){
        cin >> a[i][0] >> a[i][1];
    }
    vector<int> srt;
    cin >> c;
    vector<vector<int>> b(c, vector<int>(2));
    int sum = 0;
    for(int i = 0; i < c; ++i){
        cin >> b[i][0] >> b[i][1];
        sum += b[i][1];
        assert(sum <= (int)1e6);
        while(b[i][1]--) srt.push_back(b[i][0]);
    }

    for(int i = 0; i < r; ++i){
        while(a[i][1]--){
            sort(srt.begin(), srt.end());
            reverse(srt.begin(), srt.end());
            for(int j = 0; j < a[i][0]; ++j){
                --srt[j];
                if(srt[j] < 0){
                    cout << "0\n";
                    return 0;
                }
            }
        }
    }
    cout << "1\n";
    
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 324 KB Output is correct
7 Correct 1 ms 280 KB Output is correct
8 Correct 1 ms 324 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 320 KB Output is correct
12 Correct 1 ms 320 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 320 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 324 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 324 KB Output is correct
5 Correct 0 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 0 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 320 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 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 3 ms 320 KB Output is correct
4 Correct 2 ms 336 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 2 ms 320 KB Output is correct
9 Correct 7 ms 316 KB Output is correct
10 Correct 7 ms 320 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 7 ms 344 KB Output is correct
18 Correct 7 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 340 KB Output is correct
2 Correct 6 ms 320 KB Output is correct
3 Correct 7 ms 288 KB Output is correct
4 Correct 7 ms 320 KB Output is correct
5 Correct 9 ms 328 KB Output is correct
6 Correct 6 ms 316 KB Output is correct
7 Correct 7 ms 320 KB Output is correct
8 Correct 5 ms 340 KB Output is correct
9 Correct 8 ms 404 KB Output is correct
10 Correct 9 ms 340 KB Output is correct
11 Correct 8 ms 416 KB Output is correct
12 Correct 10 ms 412 KB Output is correct
13 Correct 8 ms 328 KB Output is correct
14 Correct 8 ms 340 KB Output is correct
15 Correct 8 ms 412 KB Output is correct
16 Correct 8 ms 320 KB Output is correct
17 Correct 8 ms 340 KB Output is correct
18 Correct 8 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 340 KB Output is correct
2 Correct 22 ms 340 KB Output is correct
3 Correct 20 ms 332 KB Output is correct
4 Correct 21 ms 464 KB Output is correct
5 Correct 16 ms 340 KB Output is correct
6 Correct 22 ms 436 KB Output is correct
7 Correct 22 ms 340 KB Output is correct
8 Correct 19 ms 340 KB Output is correct
9 Correct 24 ms 472 KB Output is correct
10 Correct 24 ms 464 KB Output is correct
11 Correct 24 ms 468 KB Output is correct
12 Correct 24 ms 468 KB Output is correct
13 Correct 23 ms 468 KB Output is correct
14 Correct 18 ms 472 KB Output is correct
15 Correct 23 ms 468 KB Output is correct
16 Correct 18 ms 468 KB Output is correct
17 Correct 29 ms 468 KB Output is correct
18 Correct 18 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 14 ms 16580 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 3136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 25 ms 24608 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 38 ms 34292 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 61 ms 48736 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -