Submission #966333

#TimeUsernameProblemLanguageResultExecution timeMemory
966333AcanikolicCurtains (NOI23_curtains)C++14
24 / 100
1520 ms57840 KiB
#include <bits/stdc++.h> #define pb push_back #define F first #define S second #define int long long using namespace std; const int N = 500000 + 10; const int mod = 998244353; const int inf = 1e9; int res[N],mx[N]; vector<int>segs[N]; vector<pair<int,int>>kveri[N]; signed main(){ ios::sync_with_stdio(false); cin.tie(0); int n,m,q; cin >> n >> m >> q; for(int i = 1; i <= m; i++) { int l,r; cin >> l >> r; segs[r].pb(l); } for(int i = 1; i <= q; i++) { int l,r; cin >> l >> r; kveri[r].pb({l,i}); } for(int i = 1; i <= n; i++) { for(auto X : segs[i]) { for(int j = X; j <= i; j++) mx[j] = max(mx[j],X); } for(auto X : kveri[i]) { int mn = inf; for(int j = X.F; j <= i; j++) { mn = min(mn,mx[j]); } if(mn >= X.F) res[X.S] = 1; else res[X.S] = 0; } } for(int i = 1; i <= q; i++) cout << (res[i] == 1 ? "YES\n" : "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...