답안 #884975

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
884975 2023-12-08T18:33:27 Z Ahmed57 Jail (JOI22_jail) C++17
5 / 100
74 ms 15188 KB
#include <bits/stdc++.h>
 
using namespace std;
signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    int t;cin>>t;z:while(t--){
    int n;
    cin>>n;
    for(int i = 0;i<n-1;i++){
        int a,b;cin>>a>>b;
    }
    int q;cin>>q;
    vector<int> adj[n+1];multiset<int> lol;
    while(q--){
        int a,b;cin>>a>>b;
        lol.insert(b);
        adj[a].push_back(b);
    }
    for(int i = 1;i<=n;i++){
        if(adj[i].empty())continue;
        sort(adj[i].begin(),adj[i].end());
        if((*lol.begin())<adj[i][0]){
            cout<<"No\n";goto z;
        }
        for(auto j:adj[i])lol.erase(j);
    }
    cout<<"Yes\n";
}
    return 0;
}
# 결과 실행 시간 메모리 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 Correct 5 ms 348 KB Output is correct
5 Correct 11 ms 1084 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 15 ms 1628 KB Output is correct
10 Correct 16 ms 4656 KB Output is correct
11 Correct 3 ms 348 KB Output is correct
12 Correct 19 ms 1340 KB Output is correct
13 Correct 31 ms 9052 KB Output is correct
14 Correct 29 ms 8872 KB Output is correct
15 Correct 34 ms 8788 KB Output is correct
16 Correct 74 ms 15184 KB Output is correct
17 Correct 35 ms 9808 KB Output is correct
18 Correct 57 ms 15188 KB Output is correct
19 Correct 35 ms 9808 KB Output is correct
20 Correct 34 ms 10064 KB Output is correct
21 Correct 42 ms 10080 KB Output is correct
22 Correct 33 ms 9976 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 544 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 492 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 544 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 492 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 544 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 492 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 544 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Incorrect 1 ms 492 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 500 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 3 ms 600 KB Output is correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Correct 5 ms 348 KB Output is correct
5 Correct 11 ms 1084 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 348 KB Output is correct
9 Correct 15 ms 1628 KB Output is correct
10 Correct 16 ms 4656 KB Output is correct
11 Correct 3 ms 348 KB Output is correct
12 Correct 19 ms 1340 KB Output is correct
13 Correct 31 ms 9052 KB Output is correct
14 Correct 29 ms 8872 KB Output is correct
15 Correct 34 ms 8788 KB Output is correct
16 Correct 74 ms 15184 KB Output is correct
17 Correct 35 ms 9808 KB Output is correct
18 Correct 57 ms 15188 KB Output is correct
19 Correct 35 ms 9808 KB Output is correct
20 Correct 34 ms 10064 KB Output is correct
21 Correct 42 ms 10080 KB Output is correct
22 Correct 33 ms 9976 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 544 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Incorrect 1 ms 492 KB Output isn't correct
27 Halted 0 ms 0 KB -