#include <bits/stdc++.h>
using namespace std;
#define fileio() freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define sp " "
#define endl "\n"
#define pii pair<int, int>
#define st first
#define nd second
#define pb push_back
#define N 100005
const int INF = 1e9 + 7;
int32_t main(){
//fileio();
fastio();
int n, m, q;
cin>>n>>m>>q;
vector<bitset<N>> dp(n + 5, 0);
vector<int> l(m + 5, 0), r(m + 5, 0), ans(q, 0);
vector<vector<int>> ex(n + 5);
vector<vector<pii>> todo(n + 5);
for (int i = 1; i <= m; i++){
cin>>l[i]>>r[i];
ex[l[i]].pb(r[i]);
}
for (int i = 1; i <= q; i++){
int s, e;
cin>>s>>e;
todo[s].pb({e, i});
}
for (int i = n; i >= 1; i--){
sort(ex[i].begin(), ex[i].end());
int last = i;
bitset<N> all(1);
for (auto j : ex[i]){
dp[i][j] = 1;
for (int k = last; k < j; k++) all[i] = 0;
while(last <= j){
last++;
dp[i] |= dp[last] & all;
}
last--;
}
//cout<<i<<": "<<dp[i]<<endl;
for (auto j : todo[i]){
if (dp[i][j.st]) ans[j.nd] = 1;
}
}
for (int i = 1; i <= q; i++) {
if (ans[i]) cout<<"YES\n";
else cout<<"NO\n";
}
cerr<<"time taken : "<<(float)clock() / CLOCKS_PER_SEC<<" seconds\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
600 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |