답안 #463425

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
463425 2021-08-11T06:28:50 Z gavgav Fountain (eJOI20_fountain) C++14
30 / 100
1500 ms 1560 KB
#include <iostream>
#include <stack>
using namespace std;
int main(){
    int32_t N, Q, level, volume;
    cin >> N >> Q;
    int32_t capacitys[N], diametrs[N], ng[N] {};
    stack <int32_t> meowmeow;
    for (int i = 0; i < N; i++){
        cin >> diametrs[i] >> capacitys[i];
        while (!meowmeow.empty() && diametrs[meowmeow.top()] < diametrs[i]){
                ng[meowmeow.top()] = i;
                meowmeow.pop();
        }
        meowmeow.push(i);
    }
    for (int32_t i = 0; i < Q; i++){
        cin >> level >> volume;
        level--;
        do{
            if (volume < capacitys[level] + 1){
                level++;
                break;
            }
            volume -= capacitys[level];
            level = ng[level];
        } while (level);
        cout << level << endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 3 ms 204 KB Output is correct
4 Correct 6 ms 204 KB Output is correct
5 Correct 8 ms 204 KB Output is correct
6 Correct 7 ms 204 KB Output is correct
7 Correct 8 ms 308 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1582 ms 1560 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 204 KB Output is correct
3 Correct 3 ms 204 KB Output is correct
4 Correct 6 ms 204 KB Output is correct
5 Correct 8 ms 204 KB Output is correct
6 Correct 7 ms 204 KB Output is correct
7 Correct 8 ms 308 KB Output is correct
8 Execution timed out 1582 ms 1560 KB Time limit exceeded
9 Halted 0 ms 0 KB -