# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131505 | 2019-07-17T08:25:23 Z | sebinkim | Bodyguards (CEOI10_bodyguards) | C++14 | 113 ms | 4784 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <ll, ll> pll; pll A[202020], B[202020]; ll n, m; void die() { printf("0\n"); exit(0); } int main() { ll i, j, s1, s2; scanf("%lld", &n); for(i=1; i<=n; i++){ scanf("%lld%lld", &A[i].first, &A[i].second); } sort(A + 1, A + n + 1); for(i=n; i>=1; i--){ A[i].second += A[i + 1].second; } scanf("%lld", &m); for(i=1; i<=m; i++){ scanf("%lld%lld", &B[i].first, &B[i].second); } sort(B + 1, B + m + 1); reverse(B + 1, B + m + 1); for(i=1, j=1, s1=0, s2=0; i<=n; i++){ for(; j<=m && B[j].first <= A[i].first; j++){ s2 += (B[j].first - B[j - 1].first) * B[j].second; if(s1 + (B[j].first - A[i - 1].first) * A[i].second < s2) die(); } s1 += (A[i].first - A[i - 1].first) * A[i].second; if(s1 < s2 + (A[i].first - B[j - 1].first) * B[j].second) die(); } printf("1\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Incorrect | 2 ms | 256 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Incorrect | 2 ms | 376 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Incorrect | 2 ms | 376 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Incorrect | 4 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 27 ms | 1484 KB | Output is correct |
2 | Incorrect | 20 ms | 1144 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 58 ms | 2680 KB | Output is correct |
2 | Incorrect | 49 ms | 2364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 113 ms | 4784 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |