# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
765173 |
2023-06-24T09:04:21 Z |
ymm |
Jail (JOI22_jail) |
C++17 |
|
37 ms |
4532 KB |
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (ll)(r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (ll)(l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;
const int N = 200'010;
tuple<int,int,int> a[N];
int n, m;
void init()
{
cin >> n;
Loop (i,1,n) {
int v, u;
cin >> v >> u;
}
cin >> m;
Loop (i,0,m) {
int x, y;
cin >> x >> y;
if (x < y)
a[i] = {x, y, 0};
else
a[i] = {y, x, 1};
}
}
void solve()
{
init();
sort(a, a+m);
int lst = -1, d = 0;
Loop (i,0,m) {
auto [x, y, d2] = a[i];
if (x > lst) {
lst = y;
d = d2;
} else {
if (y <= lst || d != d2) {
cout << "No\n";
return;
}
lst = y;
}
}
cout << "Yes\n";
}
int main()
{
cin.tie(0) -> sync_with_stdio(false);
int q;
cin >> q;
while (q--)
solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
5 ms |
596 KB |
Output is correct |
5 |
Correct |
11 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
14 ms |
724 KB |
Output is correct |
10 |
Correct |
14 ms |
1492 KB |
Output is correct |
11 |
Correct |
3 ms |
432 KB |
Output is correct |
12 |
Correct |
15 ms |
1208 KB |
Output is correct |
13 |
Correct |
20 ms |
1992 KB |
Output is correct |
14 |
Correct |
21 ms |
1996 KB |
Output is correct |
15 |
Correct |
23 ms |
2892 KB |
Output is correct |
16 |
Correct |
37 ms |
4528 KB |
Output is correct |
17 |
Correct |
21 ms |
3104 KB |
Output is correct |
18 |
Correct |
29 ms |
4532 KB |
Output is correct |
19 |
Correct |
22 ms |
3112 KB |
Output is correct |
20 |
Correct |
22 ms |
3108 KB |
Output is correct |
21 |
Correct |
24 ms |
3120 KB |
Output is correct |
22 |
Correct |
21 ms |
3116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
212 KB |
Output is correct |
4 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
3 ms |
212 KB |
Output is correct |
6 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
5 ms |
596 KB |
Output is correct |
5 |
Correct |
11 ms |
724 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
14 ms |
724 KB |
Output is correct |
10 |
Correct |
14 ms |
1492 KB |
Output is correct |
11 |
Correct |
3 ms |
432 KB |
Output is correct |
12 |
Correct |
15 ms |
1208 KB |
Output is correct |
13 |
Correct |
20 ms |
1992 KB |
Output is correct |
14 |
Correct |
21 ms |
1996 KB |
Output is correct |
15 |
Correct |
23 ms |
2892 KB |
Output is correct |
16 |
Correct |
37 ms |
4528 KB |
Output is correct |
17 |
Correct |
21 ms |
3104 KB |
Output is correct |
18 |
Correct |
29 ms |
4532 KB |
Output is correct |
19 |
Correct |
22 ms |
3112 KB |
Output is correct |
20 |
Correct |
22 ms |
3108 KB |
Output is correct |
21 |
Correct |
24 ms |
3120 KB |
Output is correct |
22 |
Correct |
21 ms |
3116 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
2 ms |
212 KB |
Output is correct |
26 |
Incorrect |
2 ms |
212 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |