답안 #994215

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
994215 2024-06-07T09:11:44 Z vjudge1 Jail (JOI22_jail) C++17
5 / 100
31 ms 1372 KB
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

bool solve() {
    int n;
    cin >> n;

    for (int i = 0; i < n - 1; i++) {
        int u, v;
        cin >> u >> v;
        u--; v--;

        if (u != i || v != i + 1)
            return false;
    }

    int m;
    cin >> m;

    vector<pair<int, int>> v(m);

    for (int i = 0; i < m; i++) {
        cin >> v[i].first >> v[i].second;
    }
   
    sort(v.begin(), v.end());

    for (int i = 0; i < m - 1; i++) {
        if (v[i].second > v[i + 1].second)
            return false;
    }

    return true;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    cin >> t;

    while (t--)
        cout << (solve() ? "Yes\n" : "No\n");
}
# 결과 실행 시간 메모리 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 5 ms 344 KB Output is correct
5 Correct 9 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 11 ms 460 KB Output is correct
10 Correct 11 ms 344 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 12 ms 348 KB Output is correct
13 Correct 17 ms 604 KB Output is correct
14 Correct 17 ms 712 KB Output is correct
15 Correct 19 ms 604 KB Output is correct
16 Correct 31 ms 1372 KB Output is correct
17 Correct 18 ms 860 KB Output is correct
18 Correct 24 ms 1368 KB Output is correct
19 Correct 19 ms 860 KB Output is correct
20 Correct 18 ms 860 KB Output is correct
21 Correct 20 ms 712 KB Output is correct
22 Correct 19 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 600 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 600 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 600 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 0 ms 600 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 5 ms 344 KB Output is correct
5 Correct 9 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 452 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 11 ms 460 KB Output is correct
10 Correct 11 ms 344 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 12 ms 348 KB Output is correct
13 Correct 17 ms 604 KB Output is correct
14 Correct 17 ms 712 KB Output is correct
15 Correct 19 ms 604 KB Output is correct
16 Correct 31 ms 1372 KB Output is correct
17 Correct 18 ms 860 KB Output is correct
18 Correct 24 ms 1368 KB Output is correct
19 Correct 19 ms 860 KB Output is correct
20 Correct 18 ms 860 KB Output is correct
21 Correct 20 ms 712 KB Output is correct
22 Correct 19 ms 860 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Incorrect 0 ms 600 KB Output isn't correct
27 Halted 0 ms 0 KB -