# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
990634 | 2024-05-30T19:34:29 Z | _Knyaz_ | Fountain (eJOI20_fountain) | C++17 | 1500 ms | 3604 KB |
#include<bits/stdc++.h> using namespace std; const int INF = 1e9+1; void in(){ freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); } vector<pair<int, int>> Fountain; int main() { //in(); int N, Q; cin >> N >> Q; for(int i = 0; i < N; i++){ int Di, Ci; cin >> Di >> Ci; Fountain.push_back(make_pair(Di, Ci)); } int Ri, Vi, Mn; for(int i = 0; i < Q; i++){ cin >> Ri >> Vi; Mn = Fountain[Ri - 1].first - 1; for(int j = Ri - 1; j < N; j++){ if(Fountain[j].second >= Vi && Fountain[j].first > Mn){ cout << j + 1 << '\n'; Vi = 0; break; } else if(Fountain[j].first > Mn){ Vi -= Fountain[j].second; Mn = Fountain[j].first; } } if(Vi > 0) cout << 0 << '\n'; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 3 ms | 348 KB | Output is correct |
5 | Correct | 4 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 444 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1546 ms | 3604 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 2 ms | 448 KB | Output is correct |
4 | Correct | 3 ms | 348 KB | Output is correct |
5 | Correct | 4 ms | 348 KB | Output is correct |
6 | Correct | 4 ms | 348 KB | Output is correct |
7 | Correct | 3 ms | 444 KB | Output is correct |
8 | Execution timed out | 1546 ms | 3604 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |