Submission #1173499

#TimeUsernameProblemLanguageResultExecution timeMemory
1173499TsaganaGift Exchange (JOI24_ho_t4)C++20
10 / 100
2595 ms4712 KiB
#include<bits/stdc++.h> #define IOS ios_base::sync_with_stdio(false);cin.tie();cout.tie(); #define all(x) x.begin(), x.end() #define int long long #define pq priority_queue #define eb emplace_back #define lb lower_bound #define ub upper_bound #define pb push_back #define pp pop_back #define F first #define S second using namespace std; vector<int> a, b; bool check(int l, int r) { vector<pair<int, int>> v; for (int i = l ; i <= r ; i++) v.pb({a[i], b[i]}); sort(all(v)); int M = v[0].S; for (auto i: v) if (M >= i.S) M = max(M, i.F); return (M >= v.back().S); } void solve () { int n; cin >> n; a = b = vector<int>(n+1); for (int i = 1; i <= n; i++) cin >> a[i]; for (int i = 1; i <= n; i++) cin >> b[i]; int q; cin >> q; while (q--) { int l, r; cin >> l >> r; if (check(l, r)) cout << "Yes\n"; else cout << "No\n"; } } signed main() {IOS 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...
#Verdict Execution timeMemoryGrader output
Fetching results...