# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
878834 | 2023-11-25T10:05:58 Z | christosalexand | Fountain (eJOI20_fountain) | C++14 | 238 ms | 3228 KB |
#include <bits/stdc++.h> using namespace std; int main() { int n,q; cin>>n>>q; int d[n], c[n]; for (int i = 0; i<n; i++) { cin>>d[i]>>c[i]; } while (q--) { int start, litres; cin>>start>>litres; int current = d[start-1]; litres-=c[start-1]; if (litres<=0) { cout<<start<<endl; continue; } bool b = false; int l = start-1; int r = n; int mid; int ans; while(l<r) { mid = (l+r)/2; if (d[mid]>current) { ans = mid; r = mid-1; } else { l++; } } litres-=c[mid]; if (litres<=0) { cout<<mid<<endl; b = true; } if (!b) { cout<<0<<endl; } } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 238 ms | 3228 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |