#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
// bismillah subtask gampang
int main() {
int soal, elang;
cin >> soal >> elang;
vector<ll> prefsum(soal + 1, 0);
for (int i = 1; i <= soal; i++)
{
ll x, y;
cin >> x >> y;
prefsum[i] = prefsum[i - 1] + y;
}
for (int i = 0; i < elang; i++)
{
int l, c;
cin >> l >> c;
int idx = upper_bound(prefsum.begin(), prefsum.end(), prefsum[l - 1] + c) - prefsum.begin();
cout << (idx == (soal + 1) ? 0 : idx) << endl;
}
}
# |
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 |
281 ms |
1856 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 |
- |