Submission #632607

#TimeUsernameProblemLanguageResultExecution timeMemory
632607MahdiJail (JOI22_jail)C++17
0 / 100
1 ms320 KiB
#include<bits/stdc++.h> #pragma GCC optimize("Ofast") using namespace std; #define all(v) v.begin(), v.end() #define F first #define S second typedef pair<int, int> pii; typedef long long ll; int n, m; void sol(){ cin>>n; for(int i=1;i<n;++i){ int u, v; cin>>u>>v; } cin>>m; vector<pii>a; for(int i=0;i<m;++i){ int u, v; cin>>u>>v; a.push_back({--u, --v}); } sort(all(a)); for(int i=0;i<m-1;++i){ if(a[i].S>=a[i+1].S){ cout<<"NO\n"; return; } } cout<<"YES\n"; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int T; cin>>T; while(T--) sol(); }
#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...