# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
119081 | 2019-06-20T09:42:57 Z | Bruteforceman | Cambridge (info1cup18_cambridge) | C++11 | 2000 ms | 1984 KB |
#include "bits/stdc++.h" using namespace std; typedef pair <int, int> pii; int t[100010], d[100010]; int opt[100010]; int query(int x, int y) { vector <pii> v; for(int i = x; i <= y; i++) { v.emplace_back(d[i], t[i]); } sort(v.begin(), v.end()); long long sum = 0; for(int i = 0; i < v.size(); i++) { sum += v[i].second; if(sum >= v[i].first) { return false; } } return true; } int main(int argc, char const *argv[]) { int n, m; scanf("%d %d", &n, &m); for(int i = 1; i <= n; i++) { scanf("%d %d", &t[i], &d[i]); } int cur = n; for(int i = n; i >= 1; i--) { while(cur >= i && !query(i, cur)) { --cur; } opt[i] = cur; } while(m--) { int p, q; scanf("%d %d", &p, &q); printf("%d\n", (opt[p] >= q)); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Execution timed out | 2067 ms | 1984 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 28 ms | 768 KB | Output is correct |
4 | Correct | 38 ms | 864 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Execution timed out | 2067 ms | 1984 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |