답안 #775985

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
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;
	}
}
# 결과 실행 시간 메모리 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
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1552 ms 4656 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -