Submission #553709

#TimeUsernameProblemLanguageResultExecution timeMemory
553709promaJail (JOI22_jail)C++17
5 / 100
57 ms5932 KiB
#include <bits/stdc++.h> using namespace std; const int N = 120005; int n, a[N], b[N], m; pair <int, int> s[N], t[N]; void solve() { cin >> n; for (int i = 1; i < n; i ++) { cin >> a[i] >> b[i]; } cin >> m; for (int i = 0; i < m; i ++) { cin >> s[i].first >> t[i].first; s[i].second = t[i].second = i; } sort(s, s + m); sort(t, t + m); for (int i = 0; i < m; i ++) { if (s[i].second != t[i].second) { cout << "No\n"; return; } } cout << "Yes\n"; } int main() { ios_base::sync_with_stdio(0); cin.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...