답안 #769881

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
769881 2023-06-30T12:27:05 Z BlockOG Fountain (eJOI20_fountain) C++14
30 / 100
1500 ms 3604 KB
#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;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1579 ms 3604 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 4 ms 340 KB Output is correct
6 Correct 4 ms 332 KB Output is correct
7 Correct 3 ms 332 KB Output is correct
8 Execution timed out 1579 ms 3604 KB Time limit exceeded
9 Halted 0 ms 0 KB -