Submission #769881

#TimeUsernameProblemLanguageResultExecution timeMemory
769881BlockOGFountain (eJOI20_fountain)C++14
30 / 100
1579 ms3604 KiB
#include <iostream> #include <vector> #include <utility> #include <algorithm> #include <cstring> #include <set> #include <cmath> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, q; cin >> n >> q; int diameters[n]; int capacities[n]; for (int i = 0; i < n; i++) cin >> diameters[i] >> capacities[i]; for (int iq = 0; iq < q; iq++) { int r, d = 0, v; cin >> r >> v; r--; for (; r < n && v > 0; r++) { if (diameters[r] > d) { d = diameters[r]; v -= capacities[r]; } } if (r == n) cout << 0 << endl; else cout << r << endl; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...