Submission #706532

# Submission time Handle Problem Language Result Execution time Memory
706532 2023-03-07T01:05:42 Z pcc Jail (JOI22_jail) C++14
5 / 100
45 ms 4160 KB
#include <bits/stdc++.h>
using namespace std;

void solve(){
    int n;
    cin>>n;
    int a,b;
    for(int i = 0;i<n-1;i++)cin>>a>>b;
    int m;
    cin>>m;
    pair<int,int> arr[m];
    for(auto &i:arr)cin>>i.first>>i.second;
    sort(arr,arr+m);
    int maxR = 0,minL = 0;
    bool flag = true;
    for(auto &i:arr){
        if(i.first>i.second){
            if(minL>i.second)flag = false;
            if(maxR>i.second)flag = false;
            minL = max(minL,i.second);
        }
        else{
            if(maxR>i.second)flag = false;
            maxR = max(maxR,i.second);
        }
    }
    if(flag)cout<<"Yes\n";
    else cout<<"No\n";
    return;
}

int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t;
    cin>>t;
    while(t--)solve();
}
# 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 1 ms 212 KB Output is correct
4 Correct 6 ms 588 KB Output is correct
5 Correct 13 ms 1056 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 372 KB Output is correct
9 Correct 16 ms 1484 KB Output is correct
10 Correct 17 ms 1696 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 19 ms 1228 KB Output is correct
13 Correct 24 ms 2636 KB Output is correct
14 Correct 25 ms 2636 KB Output is correct
15 Correct 32 ms 2604 KB Output is correct
16 Correct 45 ms 4160 KB Output is correct
17 Correct 31 ms 2848 KB Output is correct
18 Correct 34 ms 4032 KB Output is correct
19 Correct 27 ms 2864 KB Output is correct
20 Correct 26 ms 2852 KB Output is correct
21 Correct 33 ms 2844 KB Output is correct
22 Correct 26 ms 2860 KB Output is correct
# 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 332 KB Output is correct
4 Incorrect 2 ms 352 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 1 ms 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 2 ms 352 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 1 ms 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 2 ms 352 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 1 ms 212 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Incorrect 2 ms 352 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 7 ms 460 KB Output is correct
6 Incorrect 1 ms 332 KB Output isn't correct
7 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 1 ms 212 KB Output is correct
4 Correct 6 ms 588 KB Output is correct
5 Correct 13 ms 1056 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 372 KB Output is correct
9 Correct 16 ms 1484 KB Output is correct
10 Correct 17 ms 1696 KB Output is correct
11 Correct 3 ms 340 KB Output is correct
12 Correct 19 ms 1228 KB Output is correct
13 Correct 24 ms 2636 KB Output is correct
14 Correct 25 ms 2636 KB Output is correct
15 Correct 32 ms 2604 KB Output is correct
16 Correct 45 ms 4160 KB Output is correct
17 Correct 31 ms 2848 KB Output is correct
18 Correct 34 ms 4032 KB Output is correct
19 Correct 27 ms 2864 KB Output is correct
20 Correct 26 ms 2852 KB Output is correct
21 Correct 33 ms 2844 KB Output is correct
22 Correct 26 ms 2860 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Incorrect 2 ms 352 KB Output isn't correct
27 Halted 0 ms 0 KB -