Submission #778955

# Submission time Handle Problem Language Result Execution time Memory
778955 2023-07-11T05:17:19 Z 이동현(#10002) Bodyguards (CEOI10_bodyguards) C++17
50 / 100
1000 ms 262144 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));
    for(int i = 0; i < c; ++i){
        cin >> b[i][0] >> b[i][1];
        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 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 324 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 288 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 320 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 288 KB Output is correct
2 Correct 0 ms 212 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 320 KB Output is correct
11 Correct 1 ms 320 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 324 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 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 320 KB Output is correct
6 Correct 2 ms 212 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 2 ms 320 KB Output is correct
9 Correct 7 ms 340 KB Output is correct
10 Correct 7 ms 356 KB Output is correct
11 Correct 2 ms 324 KB Output is correct
12 Correct 3 ms 320 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 356 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 7 ms 344 KB Output is correct
18 Correct 7 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 340 KB Output is correct
2 Correct 6 ms 340 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 7 ms 340 KB Output is correct
5 Correct 8 ms 384 KB Output is correct
6 Correct 6 ms 340 KB Output is correct
7 Correct 7 ms 324 KB Output is correct
8 Correct 5 ms 340 KB Output is correct
9 Correct 7 ms 340 KB Output is correct
10 Correct 8 ms 324 KB Output is correct
11 Correct 7 ms 340 KB Output is correct
12 Correct 7 ms 412 KB Output is correct
13 Correct 8 ms 412 KB Output is correct
14 Correct 7 ms 340 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 324 KB Output is correct
18 Correct 7 ms 404 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 340 KB Output is correct
2 Correct 20 ms 460 KB Output is correct
3 Correct 18 ms 328 KB Output is correct
4 Correct 26 ms 340 KB Output is correct
5 Correct 16 ms 340 KB Output is correct
6 Correct 17 ms 452 KB Output is correct
7 Correct 16 ms 340 KB Output is correct
8 Correct 18 ms 340 KB Output is correct
9 Correct 22 ms 468 KB Output is correct
10 Correct 21 ms 468 KB Output is correct
11 Correct 22 ms 472 KB Output is correct
12 Correct 21 ms 480 KB Output is correct
13 Correct 21 ms 468 KB Output is correct
14 Correct 17 ms 468 KB Output is correct
15 Correct 27 ms 480 KB Output is correct
16 Correct 17 ms 468 KB Output is correct
17 Correct 29 ms 468 KB Output is correct
18 Correct 16 ms 520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 16812 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1065 ms 3140 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 245 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 221 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 224 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -