# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1057072 |
2024-08-13T13:53:58 Z |
Boas |
Jail (JOI22_jail) |
C++17 |
|
27 ms |
3548 KB |
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T1, typename T2>
using indexed_map = tree<T1, T2, less<T1>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using indexed_set = indexed_map<T, null_type>;
#define loop(x, i) for (int i = 0; i < (x); i++)
#define loop1(x, i) for (int i = 1; i <= (x); i++)
#define rev(x, i) for (int i = (int)(x) - 1; i >= 0; i--)
#define itloop(x) for (auto it = begin(x); x != end(x); it++)
#define itrev(x) for (auto it = rbegin(x); x != rend(x); it++)
#define int long long
#define INF ((int64_t)(4e18 + 1))
#define INF32 ((int32_t)(2e9 + 1))
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define existsIn(x, l) (count(ALL(l), x) > 0)
#define removeIn(x, l) l.erase(find(ALL(l), x))
#define pb push_back
#define sz(x) (int)(x).size()
#define F first
#define S second
#define var const auto &
#define foreach(l) for (var e : l)
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;
typedef vector<viii> vviii;
typedef set<int> si;
typedef set<ii> sii;
typedef set<iii> siii;
typedef vector<si> vsi;
typedef vector<sii> vsii;
typedef vector<vsi> vvsi;
typedef vector<string> vstr;
typedef vector<vector<string>> vvstr;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vi::iterator viit;
typedef si::iterator siit;
typedef int8_t in8;
typedef int16_t in16;
typedef int32_t in32;
typedef int64_t in64;
void solve()
{
int n, m, s, t, a, b, prev = 0;
cin >> n;
loop(n - 1, i) cin >> a >> b;
cin >> m;
vii segments;
loop(m, i)
{
cin >> s >> t;
segments.pb({s, t});
}
sort(ALL(segments));
for (auto [s, t] : segments)
{
if (t < prev)
{
cout << "No\n";
return;
}
prev = t;
}
cout << "Yes\n";
}
signed main()
{
cin.tie(0)->sync_with_stdio(0);
int t = 1;
cin >> t;
while (t--)
{
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
456 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
9 ms |
468 KB |
Output is correct |
10 |
Correct |
9 ms |
348 KB |
Output is correct |
11 |
Correct |
3 ms |
432 KB |
Output is correct |
12 |
Correct |
12 ms |
344 KB |
Output is correct |
13 |
Correct |
15 ms |
1496 KB |
Output is correct |
14 |
Correct |
15 ms |
1604 KB |
Output is correct |
15 |
Correct |
20 ms |
1384 KB |
Output is correct |
16 |
Correct |
27 ms |
2520 KB |
Output is correct |
17 |
Correct |
15 ms |
1604 KB |
Output is correct |
18 |
Correct |
22 ms |
2520 KB |
Output is correct |
19 |
Correct |
19 ms |
3456 KB |
Output is correct |
20 |
Correct |
20 ms |
3548 KB |
Output is correct |
21 |
Correct |
18 ms |
3548 KB |
Output is correct |
22 |
Correct |
18 ms |
3548 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
2 ms |
348 KB |
Output is correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
3 ms |
348 KB |
Output is correct |
5 |
Correct |
7 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
456 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
9 ms |
468 KB |
Output is correct |
10 |
Correct |
9 ms |
348 KB |
Output is correct |
11 |
Correct |
3 ms |
432 KB |
Output is correct |
12 |
Correct |
12 ms |
344 KB |
Output is correct |
13 |
Correct |
15 ms |
1496 KB |
Output is correct |
14 |
Correct |
15 ms |
1604 KB |
Output is correct |
15 |
Correct |
20 ms |
1384 KB |
Output is correct |
16 |
Correct |
27 ms |
2520 KB |
Output is correct |
17 |
Correct |
15 ms |
1604 KB |
Output is correct |
18 |
Correct |
22 ms |
2520 KB |
Output is correct |
19 |
Correct |
19 ms |
3456 KB |
Output is correct |
20 |
Correct |
20 ms |
3548 KB |
Output is correct |
21 |
Correct |
18 ms |
3548 KB |
Output is correct |
22 |
Correct |
18 ms |
3548 KB |
Output is correct |
23 |
Correct |
0 ms |
348 KB |
Output is correct |
24 |
Correct |
0 ms |
348 KB |
Output is correct |
25 |
Correct |
0 ms |
348 KB |
Output is correct |
26 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |