Submission #641981

# Submission time Handle Problem Language Result Execution time Memory
641981 2022-09-18T06:30:44 Z moday_morning Fountain (eJOI20_fountain) C++17
0 / 100
1500 ms 3936 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
vector <pair <int, int>> a(2e5+3);

signed main() {
    int n, q;
    cin >> n >> q;
    for (int i = 1; i <= n; i++) {
        cin >> a[i].first >> a[i].second;
    }
    while (q--) {
        int r, v;
        cin >> r >> v;
        int sum = v;
        for (int i = r; i <= n; i++) {
            sum -= a[i].second;
            if (sum < 0) {
                cout << i << "\n";
                goto link;
            }
        }
        if (sum > 0) {
            cout << "0\n";
        }
        link:
        int s;
    }
}

/*
 
5 1
1 2 1 2 1

 */

Compilation message

fountain.cpp: In function 'int main()':
fountain.cpp:27:13: warning: unused variable 's' [-Wunused-variable]
   27 |         int s;
      |             ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1526 ms 3936 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -