# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
779822 | 2023-07-12T00:00:58 Z | 79brue | Bodyguards (CEOI10_bodyguards) | C++17 | 1000 ms | 8756 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]; 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); /// 긴 것부터 ll level = b[1].first; /// 초기 시작 위치 ll limit = 1; /// 오른쪽 한계 ll limitSum = b[1].second; ll cur = 0; /// 현재 채운 칸 위치 for(int i=1; i<=n; i++){ ll v = a[i].first * a[i].second; while(v){ while(limit < n && level <= b[limit+1].second) limitSum += b[++limit].second; if(a[i].first > limitSum && !(b[limit+1].first >= a[i].first && b[limit+1].second == level-1)){ puts("0"); return 0; } ll tmp = min(v, limitSum * (level - b[limit+1].second) - cur); v -= tmp; level -= (cur+tmp)/limitSum; cur = (cur+tmp)%limitSum; } } puts("1"); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Execution timed out | 1081 ms | 212 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 316 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Incorrect | 1 ms | 212 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 316 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 212 KB | Output is correct |
4 | Incorrect | 1 ms | 308 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 320 KB | Output is correct |
2 | Incorrect | 1 ms | 340 KB | Output isn't correct |
3 | 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 | Execution timed out | 1055 ms | 596 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1072 ms | 2224 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 34 ms | 4836 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 65 ms | 8756 KB | Output is correct |
2 | Correct | 63 ms | 8584 KB | Output is correct |
3 | Correct | 56 ms | 7568 KB | Output is correct |
4 | Incorrect | 22 ms | 3136 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |