Submission #620105

# Submission time Handle Problem Language Result Execution time Memory
620105 2022-08-02T23:55:48 Z Jovan26 Fountain (eJOI20_fountain) C++14
30 / 100
1500 ms 4304 KB
#include<iostream>
using namespace std;
int main(){
	int n,q;
	cin>>n>>q;
	int d[n+1],c[n+1],r[q],v[q];
	d[0]=0;
	c[0]=0;
	for(int i=1;i<=n;i++){
		cin>>d[i]>>c[i];
	}
	int p;
	for(int i=0;i<q;i++){
		cin>>r[i]>>v[i];
		p=0;
		for(int j=r[i];j<=n;j++){
			if(d[j]>p){
				v[i]-=c[j];
				p=d[j];
			}
				if(v[i]<=0) {
				cout<<j<<endl;
				break;
		}
		if(j==n){
			cout<<0<<endl;
			break;
		}
			}
		}
	}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 8 ms 444 KB Output is correct
6 Correct 6 ms 340 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1581 ms 4304 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 300 KB Output is correct
2 Correct 2 ms 212 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 4 ms 340 KB Output is correct
5 Correct 8 ms 444 KB Output is correct
6 Correct 6 ms 340 KB Output is correct
7 Correct 4 ms 340 KB Output is correct
8 Execution timed out 1581 ms 4304 KB Time limit exceeded
9 Halted 0 ms 0 KB -