Submission #975363

# Submission time Handle Problem Language Result Execution time Memory
975363 2024-05-05T03:15:52 Z vjudge1 Fountain (eJOI20_fountain) C++17
30 / 100
1500 ms 1452 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	int n, q; cin >> n >> q;
	int questions[n][2];  // n[0] = rating, n[1] = imple
	for(int i = 0 ; i < n ; i++) cin >> questions[i][0] >> questions[i][1];
	int ans[q];	
	
	for(int i = 0 ;i < q ; i++){
		int analysis = 0;
		int awal, imple; cin >> awal >> imple;
		for(int j = awal - 1 ; j < n ; j++){
			if(analysis < questions[j][0]){
				imple -= questions[j][1];
				analysis = questions[j][0];
				if(imple <= 0){
					ans[i] = j + 1;
					break;
				}
			}
		}
		if(imple > 0) ans[i] = 0;
	}
	
	for(int i = 0 ; i < q ; i++) cout << ans[i] << endl;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 464 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1585 ms 1452 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 4 ms 348 KB Output is correct
6 Correct 4 ms 464 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Execution timed out 1585 ms 1452 KB Time limit exceeded
9 Halted 0 ms 0 KB -