# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
778964 | 2023-07-11T05:47:17 Z | 박상훈(#10000) | Bodyguards (CEOI10_bodyguards) | C++17 | 188 ms | 262144 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; pair<int, int> a[200200], b[200200]; void NO(){ printf("0\n"); exit(0); } int main(){ int n, m; scanf("%d", &n); vector<int> X, Y; for (int i=1;i<=n;i++){ int x, y; scanf("%d %d", &x, &y); a[i] = {x, y}; for (int j=1;j<=y;j++) X.push_back(x); } scanf("%d", &m); for (int i=1;i<=m;i++){ int x, y; scanf("%d %d", &x, &y); b[i] = {x, y}; for (int j=1;j<=y;j++) Y.push_back(x); } ll cur = 0; for (int i=0;i<(int)Y.size();i++){ cur += Y[i]; ll val = 0; for (int j=0;j<(int)X.size();j++) val += min(X[j], i+1); if (cur > val) NO(); } swap(X, Y); cur = 0; for (int i=0;i<(int)Y.size();i++){ cur += Y[i]; ll val = 0; for (int j=0;j<(int)X.size();j++) val += min(X[j], i+1); if (cur > val) NO(); } printf("1\n"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | 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 | Incorrect | 0 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 174 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 182 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 174 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 172 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 188 ms | 262144 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |