Submission #1112925

#TimeUsernameProblemLanguageResultExecution timeMemory
1112925AvianshCurtains (NOI23_curtains)C++17
0 / 100
1552 ms932 KiB
#include <bits/stdc++.h> using namespace std; signed main(){ ios::sync_with_stdio(0); cin.tie(0); int n,m,q; cin >> n >> m >> q; vector<array<int,2>>events[n+1]; for(int i = 0;i<m;i++){ int a,b; cin >> a >> b; events[a].push_back({a,b}); events[b].push_back({a,b}); } while(q--){ int a,b; cin >> a >> b; int minima = a; priority_queue<int,vector<int>,greater<int>>mins; bool work = 1; for(int i = a;i<=b;i++){ for(array<int,2>a:events[i]){ mins.push(a[1]); } if(mins.size()==0){ work=false; break; } minima=max(minima,mins.top()); while(mins.size()&&mins.top()==i){ mins.pop(); } } if(minima==b&&work){ cout << "YES\n"; } else{ cout << "NO\n"; } } return 0; }
#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...