Submission #902895

#TimeUsernameProblemLanguageResultExecution timeMemory
902895Tuanlinh123Jail (JOI22_jail)C++17
0 / 100
5 ms468 KiB
#include<bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define pb push_back #define mp make_pair #define fi first #define se second #define ld long double using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll t; cin >> t; while (t--) { ll n; cin >> n; for (ll i=1; i<n; i++) { ll u, v; cin >> u >> v; } ll m; cin >> m; vector <pll> range; for (ll i=1; i<=m; i++) { ll l, r; cin >> l >> r; if (l>r) swap(l, r); range.pb({l, -r}); } sort(range.begin(), range.end()); ll Max=0, ok=1; for (pll i:range) { ll l=i.fi, r=-i.se; if (Max>=r) {ok=0; break;} Max=r; } if (ok) cout << "Yes\n"; else cout << "No\n"; } }

Compilation message (stderr)

jail.cpp: In function 'int main()':
jail.cpp:36:16: warning: unused variable 'l' [-Wunused-variable]
   36 |             ll l=i.fi, r=-i.se;
      |                ^
#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...