Submission #858304

#TimeUsernameProblemLanguageResultExecution timeMemory
858304willychanJail (JOI22_jail)C++14
0 / 100
1 ms456 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; //#include<bits/extc++.h> //__gnu_pbds void solve(){ int n;cin>>n; for(int i=0;i<n-1;i++){ int a,b;cin>>a>>b; } vector<pair<int,int> > arr; int m;cin>>m; for(int i=0;i<m;i++){ int s,t;cin>>s>>t; arr.push_back({s,t}); } sort(arr.begin(),arr.end()); for(int i=1;i<m;i++){ if(arr[i].second<arr[i].first){ cout<<"No\n"; return; } } cout<<"Yes\n"; return ; } int main(){ ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0); int q;cin>>q; while(q--){ solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...