Submission #775985

# Submission time Handle Problem Language Result Execution time Memory
775985 2023-07-07T08:06:57 Z vjudge1 Fountain (eJOI20_fountain) C++17
30 / 100
1500 ms 4656 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define ll long long
#define pb push_back
#define N 2000005                                                                                
int main(){
	lalala;
	int n,q;cin>>n>>q;
	ll int arr[n][2],pre[n+1];
	pre[0]=0;
	for(int i=0;i<n;i++){
		cin>>arr[i][0]>>arr[i][1];
		pre[i+1]=arr[i][1]+pre[i];
	}
	while(q--){
		ll int x,y;cin>>x>>y;
		x--;
		ll int cev=-1,cur=arr[x][0]-1;
		for(int i=x;i<n;i++){
			if(arr[i][0]<=cur)continue;
			cur=arr[i][0];
			//cout<<y<<" "<<arr[i][1]<<" "<<i<<endl;
			if(arr[i][1]<y){
				y-=arr[i][1];continue;
			}
			cev=i;
			break;
		}
		cout<<cev+1<<endl;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1552 ms 4656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 328 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Execution timed out 1552 ms 4656 KB Time limit exceeded
9 Halted 0 ms 0 KB -