# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
586956 | 2022-07-01T06:25:08 Z | Halym2007 | Fountain (eJOI20_fountain) | C++14 | 23 ms | 4072 KB |
#include <bits/stdc++.h> #define ff first #define ss second #define cont continue; #define sz size() #define pb push_back using namespace std; typedef long long ll; const int N = 200009; int n, q, a[N], jog, b[N], p[N], l, r; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> q; for (int i = 1; i <= n; ++i) { cin >> a[i] >> b[i]; p[i] += p[i - 1] + b[i]; } while ( q-- ) { cin >> l >> r; if (p[n] - p[l - 1] < r) { cout << "0\n"; } int l1 = l + 1, r1 = n; while (l <= r) { int md = (l + r) / 2; if (p[md] - p[l - 1] < r) l = md + 1; else { r = md - 1; jog = md; } } cout << jog << "\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 23 ms | 4072 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |