제출 #463425

#제출 시각아이디문제언어결과실행 시간메모리
463425gavgavFountain (eJOI20_fountain)C++14
30 / 100
1582 ms1560 KiB
#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; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...