# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
841808 | 2023-09-02T06:46:22 Z | konber | Fountain (eJOI20_fountain) | C++14 | 14 ms | 2404 KB |
#include <iostream> using namespace std; int main() { //freopen("data.in", "r", stdin); int N, Q, r, c, last, i; scanf("%d%d", &N, &Q); int d[N+1], v[N+1]; for(int j=1; j <= N; j++) scanf("%d%d", &d[j], &v[j]); if (N > 1000 || Q > 2000) return 0; while(Q--){ scanf("%d%d", &r, &c); last = r; c -= v[r]; for(i=r; i <= N && c > 0; i++){ if(d[i] > d[last]){ c -= v[i]; last = i; } } printf("%d\n", (c <= 0) ? last : 0); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 2404 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 2 ms | 348 KB | Output is correct |
6 | Correct | 2 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
8 | Incorrect | 14 ms | 2404 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |