# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
916538 | 2024-01-26T04:53:03 Z | pan | Curtains (NOI23_curtains) | C++17 | 1185 ms | 21172 KB |
#include <bits/stdc++.h> //#include "bits_stdc++.h" #include <stdio.h> #include <algorithm> #include <memory.h> #define f first #define s second #define mp make_pair #define pb push_back #define lb lower_bound #define ub upper_bound #define input(x) scanf("%lld", &x); #define print(x, y) printf("%lld%c", x, y); #define show(x) cerr << #x << " is " << x << endl; #define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl; #define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl; using namespace std; typedef long long ll; typedef long double ld; typedef pair<ld, ll> pd; typedef pair<string, ll> psl; typedef pair<ll, ll> pi; vector<vector<ll> > leftt; vector<ll> pointer; bool dp[2005][2005]; int main() { ll n, m, q, l ,r; input(n); input(m); input(q); leftt.resize(n+1); pointer.assign(n+1, 0); for (ll i=0; i<m; ++i) { input(l); input(r); leftt[r].pb(l); } for (ll i=1; i<=n; ++i) sort(leftt[i].begin(), leftt[i].end()); for (ll i= 1; i<=n; ++i) { ll last = i; for (ll j=i; j<=n; ++j) { //show2(i, j); //show(pointer[j]); if (leftt[j].empty()) {dp[i][j] = false; continue;} while (pointer[j]<leftt[j].size()-1 && leftt[j][pointer[j]]<i) {pointer[j]++;} //show(leftt[j][pointer[j]]); if (leftt[j].size() && leftt[j][pointer[j]]>=i && leftt[j][pointer[j]]<=last) {last = j+1; dp[i][j] = true;} else dp[i][j] = false; } } while (q--) { input(l); input(r); if (dp[l][r]) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 2652 KB | Output is correct |
4 | Correct | 2 ms | 2652 KB | Output is correct |
5 | Correct | 1 ms | 2652 KB | Output is correct |
6 | Correct | 1 ms | 2468 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 | 2496 KB | Output is correct |
10 | Correct | 1 ms | 2652 KB | Output is correct |
11 | Correct | 1 ms | 2440 KB | Output is correct |
12 | Correct | 1 ms | 2652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 2652 KB | Output is correct |
4 | Correct | 2 ms | 2652 KB | Output is correct |
5 | Correct | 1 ms | 2652 KB | Output is correct |
6 | Correct | 1 ms | 2468 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 | 2496 KB | Output is correct |
10 | Correct | 1 ms | 2652 KB | Output is correct |
11 | Correct | 1 ms | 2440 KB | Output is correct |
12 | Correct | 1 ms | 2652 KB | Output is correct |
13 | Correct | 10 ms | 4440 KB | Output is correct |
14 | Correct | 10 ms | 4444 KB | Output is correct |
15 | Correct | 10 ms | 4408 KB | Output is correct |
16 | Correct | 10 ms | 4444 KB | Output is correct |
17 | Correct | 10 ms | 4444 KB | Output is correct |
18 | Correct | 9 ms | 4440 KB | Output is correct |
19 | Correct | 12 ms | 4416 KB | Output is correct |
20 | Correct | 8 ms | 4444 KB | Output is correct |
21 | Correct | 9 ms | 4440 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 2652 KB | Output is correct |
4 | Correct | 2 ms | 2652 KB | Output is correct |
5 | Correct | 1 ms | 2652 KB | Output is correct |
6 | Correct | 1 ms | 2468 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 | 2496 KB | Output is correct |
10 | Correct | 1 ms | 2652 KB | Output is correct |
11 | Correct | 1 ms | 2440 KB | Output is correct |
12 | Correct | 1 ms | 2652 KB | Output is correct |
13 | Correct | 10 ms | 4440 KB | Output is correct |
14 | Correct | 10 ms | 4444 KB | Output is correct |
15 | Correct | 10 ms | 4408 KB | Output is correct |
16 | Correct | 10 ms | 4444 KB | Output is correct |
17 | Correct | 10 ms | 4444 KB | Output is correct |
18 | Correct | 9 ms | 4440 KB | Output is correct |
19 | Correct | 12 ms | 4416 KB | Output is correct |
20 | Correct | 8 ms | 4444 KB | Output is correct |
21 | Correct | 9 ms | 4440 KB | Output is correct |
22 | Correct | 658 ms | 10264 KB | Output is correct |
23 | Correct | 680 ms | 11100 KB | Output is correct |
24 | Correct | 670 ms | 13140 KB | Output is correct |
25 | Correct | 764 ms | 21172 KB | Output is correct |
26 | Correct | 644 ms | 10580 KB | Output is correct |
27 | Correct | 794 ms | 21072 KB | Output is correct |
28 | Correct | 743 ms | 21172 KB | Output is correct |
29 | Correct | 726 ms | 10144 KB | Output is correct |
30 | Correct | 640 ms | 9556 KB | Output is correct |
31 | Correct | 644 ms | 10576 KB | Output is correct |
32 | Correct | 748 ms | 20048 KB | Output is correct |
33 | Correct | 683 ms | 9808 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 2652 KB | Output is correct |
3 | Correct | 1 ms | 2492 KB | Output is correct |
4 | Correct | 1 ms | 2652 KB | Output is correct |
5 | Correct | 10 ms | 4440 KB | Output is correct |
6 | Correct | 9 ms | 4444 KB | Output is correct |
7 | Correct | 9 ms | 4444 KB | Output is correct |
8 | Correct | 701 ms | 9712 KB | Output is correct |
9 | Correct | 647 ms | 10996 KB | Output is correct |
10 | Correct | 734 ms | 20052 KB | Output is correct |
11 | Correct | 646 ms | 9740 KB | Output is correct |
12 | Runtime error | 1185 ms | 20240 KB | Execution killed with signal 11 |
13 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 2652 KB | Output is correct |
4 | Correct | 2 ms | 2652 KB | Output is correct |
5 | Correct | 1 ms | 2652 KB | Output is correct |
6 | Correct | 1 ms | 2468 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 | 2496 KB | Output is correct |
10 | Correct | 1 ms | 2652 KB | Output is correct |
11 | Correct | 1 ms | 2440 KB | Output is correct |
12 | Correct | 1 ms | 2652 KB | Output is correct |
13 | Correct | 10 ms | 4440 KB | Output is correct |
14 | Correct | 10 ms | 4444 KB | Output is correct |
15 | Correct | 10 ms | 4408 KB | Output is correct |
16 | Correct | 10 ms | 4444 KB | Output is correct |
17 | Correct | 10 ms | 4444 KB | Output is correct |
18 | Correct | 9 ms | 4440 KB | Output is correct |
19 | Correct | 12 ms | 4416 KB | Output is correct |
20 | Correct | 8 ms | 4444 KB | Output is correct |
21 | Correct | 9 ms | 4440 KB | Output is correct |
22 | Runtime error | 93 ms | 13168 KB | Execution killed with signal 11 |
23 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 2 ms | 2652 KB | Output is correct |
4 | Correct | 2 ms | 2652 KB | Output is correct |
5 | Correct | 1 ms | 2652 KB | Output is correct |
6 | Correct | 1 ms | 2468 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 | 2496 KB | Output is correct |
10 | Correct | 1 ms | 2652 KB | Output is correct |
11 | Correct | 1 ms | 2440 KB | Output is correct |
12 | Correct | 1 ms | 2652 KB | Output is correct |
13 | Correct | 10 ms | 4440 KB | Output is correct |
14 | Correct | 10 ms | 4444 KB | Output is correct |
15 | Correct | 10 ms | 4408 KB | Output is correct |
16 | Correct | 10 ms | 4444 KB | Output is correct |
17 | Correct | 10 ms | 4444 KB | Output is correct |
18 | Correct | 9 ms | 4440 KB | Output is correct |
19 | Correct | 12 ms | 4416 KB | Output is correct |
20 | Correct | 8 ms | 4444 KB | Output is correct |
21 | Correct | 9 ms | 4440 KB | Output is correct |
22 | Correct | 658 ms | 10264 KB | Output is correct |
23 | Correct | 680 ms | 11100 KB | Output is correct |
24 | Correct | 670 ms | 13140 KB | Output is correct |
25 | Correct | 764 ms | 21172 KB | Output is correct |
26 | Correct | 644 ms | 10580 KB | Output is correct |
27 | Correct | 794 ms | 21072 KB | Output is correct |
28 | Correct | 743 ms | 21172 KB | Output is correct |
29 | Correct | 726 ms | 10144 KB | Output is correct |
30 | Correct | 640 ms | 9556 KB | Output is correct |
31 | Correct | 644 ms | 10576 KB | Output is correct |
32 | Correct | 748 ms | 20048 KB | Output is correct |
33 | Correct | 683 ms | 9808 KB | Output is correct |
34 | Correct | 1 ms | 344 KB | Output is correct |
35 | Correct | 1 ms | 2652 KB | Output is correct |
36 | Correct | 1 ms | 2492 KB | Output is correct |
37 | Correct | 1 ms | 2652 KB | Output is correct |
38 | Correct | 10 ms | 4440 KB | Output is correct |
39 | Correct | 9 ms | 4444 KB | Output is correct |
40 | Correct | 9 ms | 4444 KB | Output is correct |
41 | Correct | 701 ms | 9712 KB | Output is correct |
42 | Correct | 647 ms | 10996 KB | Output is correct |
43 | Correct | 734 ms | 20052 KB | Output is correct |
44 | Correct | 646 ms | 9740 KB | Output is correct |
45 | Runtime error | 1185 ms | 20240 KB | Execution killed with signal 11 |
46 | Halted | 0 ms | 0 KB | - |