#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// bismillah subtask gampang
int main() {
int soal, elang;
cin >> soal >> elang;
vector<int> prefsum(soal + 1, 0);
for (int i = 1; i <= soal; i++)
{
int 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 |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
255 ms |
4436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |