제출 #1261464

#제출 시각아이디문제언어결과실행 시간메모리
1261464liangjeremyCurtains (NOI23_curtains)C++20
9 / 100
1595 ms5640 KiB
#include<bits/stdc++.h>
#define fi first
#define se second
#define int long long
using namespace std;
using db=double;
using ll=int64_t;
using sll=__int128;
using lb=long double;

int32_t main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0));
    int n,m,q; cin>>n>>m>>q; vector<set<int>>a(n+1);
    for(int i=1; i<=m; i++){
    	int l,r; cin>>l>>r; a[l].insert(r); 
    }
    while(q--){
    	int l,r; cin>>l>>r; int idx=l-1; 
    	for(int i=l; i<=r; i++){
    		if(a[i].empty() || idx+1<i)continue;
    		auto it=a[i].upper_bound(r); 
    		if(it==a[i].begin())continue;
    		idx=max(idx,*prev(it)); 
    	}
    	if(idx==r)cout<<"YES"<<'\n'; else cout<<"NO"<<'\n';
    }
}
/*
O what can ail thee, knight-at-arms,
       Alone and palely loitering?
The sedge has withered from the lake,
       And no birds sing.
 
O what can ail thee, knight-at-arms,
       So haggard and so woe-begone?
The squirrel’s granary is full,
       And the harvest’s done.
 
I see a lily on thy brow,
       With anguish moist and fever-dew,
And on thy cheeks a fading rose
       Fast withereth too. 
*/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...