#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define in insert
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define ff first
#define ss second
#define int long long
typedef long long ll;
typedef vector<int> vi;
typedef set<int> si;
typedef multiset<int> msi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
// typedef pair<int, int> P;
template<typename T, typename U>
ostream & operator << (ostream &out, const pair<T, U> &c) {
out << c.first << ' ' << c.second;
return out;
}
template<typename T>
ostream & operator << (ostream &out, vector<T> &v) {
const int sz = v.size();
for (int i = 0; i < sz; i++) {
if (i) out << ' ';
out << v[i];
}
return out;
}
template<typename T>
istream & operator >> (istream &in, vector<T> &v) {
for (T &x : v) in >> x;
return in;
}
template<typename T, typename U>
istream & operator >> (istream &in, pair<T, U> &c) {
in >> c.first;
in >> c.second;
return in;
}
template<typename T>
void mxx(T &a, T b){if(b > a) a = b;}
template<typename T>
void mnn(T &a, T b){if(b < a) a = b;}
const int mxn = 2010, MXLOG = 22, mod = 1e9 + 7, P = 1181, D = 1523, N = 2500;
const long long inf = 2e18 + 10;
bool can[mxn][mxn];
vector<int> g[mxn];
void go() {
int n, m, q;
cin >> n >> m >> q;
for(int i = 1; i <= m; i++) {
int l, r;
cin >> l >> r;
g[l].pb(r);
}
for(int i = 1; i <= n; i++) {
sort(all(g[i]));
}
for(int i = 1; i <= n; i++) {
int ls = i + 1;
for(int j = i; j >= 1; j--) {
int id = lower_bound(all(g[j]), ls - 1) - g[j].begin();
if(id < g[j].size() && g[j][id] <= i) ls = j;
if(ls == j) can[j][i] = 1;
}
}
while(q--) {
int l, r;
cin >> l >> r;
if(can[l][r]) cout << "YES\n";
else cout << "NO\n";
}
}
signed main() {
fast;
int t = 1;
// cin >> t;
while(t--) {
go();
}
return 0;
}
Compilation message
curtains.cpp: In function 'void go()':
curtains.cpp:76:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
76 | if(id < g[j].size() && g[j][id] <= i) ls = j;
| ~~~^~~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2648 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2648 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
11 ms |
3536 KB |
Output is correct |
14 |
Correct |
11 ms |
3932 KB |
Output is correct |
15 |
Correct |
11 ms |
3788 KB |
Output is correct |
16 |
Correct |
10 ms |
3572 KB |
Output is correct |
17 |
Correct |
11 ms |
3744 KB |
Output is correct |
18 |
Correct |
11 ms |
4184 KB |
Output is correct |
19 |
Correct |
9 ms |
4184 KB |
Output is correct |
20 |
Correct |
6 ms |
4444 KB |
Output is correct |
21 |
Correct |
7 ms |
4360 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2648 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
11 ms |
3536 KB |
Output is correct |
14 |
Correct |
11 ms |
3932 KB |
Output is correct |
15 |
Correct |
11 ms |
3788 KB |
Output is correct |
16 |
Correct |
10 ms |
3572 KB |
Output is correct |
17 |
Correct |
11 ms |
3744 KB |
Output is correct |
18 |
Correct |
11 ms |
4184 KB |
Output is correct |
19 |
Correct |
9 ms |
4184 KB |
Output is correct |
20 |
Correct |
6 ms |
4444 KB |
Output is correct |
21 |
Correct |
7 ms |
4360 KB |
Output is correct |
22 |
Correct |
92 ms |
9060 KB |
Output is correct |
23 |
Correct |
89 ms |
10524 KB |
Output is correct |
24 |
Correct |
119 ms |
12860 KB |
Output is correct |
25 |
Correct |
187 ms |
21072 KB |
Output is correct |
26 |
Correct |
100 ms |
10200 KB |
Output is correct |
27 |
Correct |
218 ms |
21328 KB |
Output is correct |
28 |
Correct |
208 ms |
21044 KB |
Output is correct |
29 |
Correct |
101 ms |
9900 KB |
Output is correct |
30 |
Correct |
79 ms |
9220 KB |
Output is correct |
31 |
Correct |
93 ms |
10600 KB |
Output is correct |
32 |
Correct |
205 ms |
19900 KB |
Output is correct |
33 |
Correct |
76 ms |
9656 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
2652 KB |
Output is correct |
3 |
Correct |
1 ms |
2648 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
11 ms |
3508 KB |
Output is correct |
6 |
Correct |
9 ms |
4188 KB |
Output is correct |
7 |
Correct |
11 ms |
4168 KB |
Output is correct |
8 |
Correct |
76 ms |
9124 KB |
Output is correct |
9 |
Correct |
85 ms |
10456 KB |
Output is correct |
10 |
Correct |
184 ms |
20020 KB |
Output is correct |
11 |
Correct |
80 ms |
9716 KB |
Output is correct |
12 |
Runtime error |
45 ms |
10836 KB |
Execution killed with signal 11 |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2648 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
11 ms |
3536 KB |
Output is correct |
14 |
Correct |
11 ms |
3932 KB |
Output is correct |
15 |
Correct |
11 ms |
3788 KB |
Output is correct |
16 |
Correct |
10 ms |
3572 KB |
Output is correct |
17 |
Correct |
11 ms |
3744 KB |
Output is correct |
18 |
Correct |
11 ms |
4184 KB |
Output is correct |
19 |
Correct |
9 ms |
4184 KB |
Output is correct |
20 |
Correct |
6 ms |
4444 KB |
Output is correct |
21 |
Correct |
7 ms |
4360 KB |
Output is correct |
22 |
Runtime error |
48 ms |
11988 KB |
Execution killed with signal 11 |
23 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
6 |
Correct |
1 ms |
2652 KB |
Output is correct |
7 |
Correct |
1 ms |
2652 KB |
Output is correct |
8 |
Correct |
1 ms |
2652 KB |
Output is correct |
9 |
Correct |
1 ms |
2648 KB |
Output is correct |
10 |
Correct |
1 ms |
2648 KB |
Output is correct |
11 |
Correct |
1 ms |
2652 KB |
Output is correct |
12 |
Correct |
1 ms |
2652 KB |
Output is correct |
13 |
Correct |
11 ms |
3536 KB |
Output is correct |
14 |
Correct |
11 ms |
3932 KB |
Output is correct |
15 |
Correct |
11 ms |
3788 KB |
Output is correct |
16 |
Correct |
10 ms |
3572 KB |
Output is correct |
17 |
Correct |
11 ms |
3744 KB |
Output is correct |
18 |
Correct |
11 ms |
4184 KB |
Output is correct |
19 |
Correct |
9 ms |
4184 KB |
Output is correct |
20 |
Correct |
6 ms |
4444 KB |
Output is correct |
21 |
Correct |
7 ms |
4360 KB |
Output is correct |
22 |
Correct |
92 ms |
9060 KB |
Output is correct |
23 |
Correct |
89 ms |
10524 KB |
Output is correct |
24 |
Correct |
119 ms |
12860 KB |
Output is correct |
25 |
Correct |
187 ms |
21072 KB |
Output is correct |
26 |
Correct |
100 ms |
10200 KB |
Output is correct |
27 |
Correct |
218 ms |
21328 KB |
Output is correct |
28 |
Correct |
208 ms |
21044 KB |
Output is correct |
29 |
Correct |
101 ms |
9900 KB |
Output is correct |
30 |
Correct |
79 ms |
9220 KB |
Output is correct |
31 |
Correct |
93 ms |
10600 KB |
Output is correct |
32 |
Correct |
205 ms |
19900 KB |
Output is correct |
33 |
Correct |
76 ms |
9656 KB |
Output is correct |
34 |
Correct |
1 ms |
348 KB |
Output is correct |
35 |
Correct |
1 ms |
2652 KB |
Output is correct |
36 |
Correct |
1 ms |
2648 KB |
Output is correct |
37 |
Correct |
1 ms |
2652 KB |
Output is correct |
38 |
Correct |
11 ms |
3508 KB |
Output is correct |
39 |
Correct |
9 ms |
4188 KB |
Output is correct |
40 |
Correct |
11 ms |
4168 KB |
Output is correct |
41 |
Correct |
76 ms |
9124 KB |
Output is correct |
42 |
Correct |
85 ms |
10456 KB |
Output is correct |
43 |
Correct |
184 ms |
20020 KB |
Output is correct |
44 |
Correct |
80 ms |
9716 KB |
Output is correct |
45 |
Runtime error |
45 ms |
10836 KB |
Execution killed with signal 11 |
46 |
Halted |
0 ms |
0 KB |
- |