답안 #912426

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
912426 2024-01-19T12:50:35 Z speedcode Fountain (eJOI20_fountain) C++17
30 / 100
1500 ms 3816 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, q;
    cin >> n >> q;

    long long diameters[n+1];
    long long capacities[n+1];

    for(int i = 1; i <= n; i++) cin >> diameters[i] >> capacities[i];
    
    int ri;
    long long vi;

    for(int i = 0; i < q; i++){
        cin >> ri >> vi;

        long long lastDiameter = -1;
        int j = ri;
        for(j = ri; j <= n; ){
            j++;
            if(lastDiameter >= diameters[j-1]) continue;
            lastDiameter = diameters[j-1];
            if (vi <= capacities[j-1]){
                j--;
                break;
            } else {
                vi -= capacities[j-1];
            }
        }
        if(j <= n) cout << j << '\n';
        else cout << "0\n";
    }

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1515 ms 3816 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 344 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Execution timed out 1515 ms 3816 KB Time limit exceeded
9 Halted 0 ms 0 KB -