제출 #1158915

#제출 시각아이디문제언어결과실행 시간메모리
1158915vako_pPassport (JOI23_passport)C++20
0 / 100
0 ms328 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define debug(x) cerr << '\n' << __LINE__ << ": " << (#x) << " is " << (x) << endl; //#define cerr if(false) cerr const int mxN = 1e6 + 5; ll n,R1[mxN]; pair<ll,ll> a[mxN]; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i].first >> a[i].second; R1[i] = max(R1[i - 1], a[i].second); } ll q; cin >> q; while(q--){ ll x; cin >> x; ll res = 1; while(x < n){ if(R1[x] <= x){ res = -1; break; } x = R1[x]; res++; } cout << res << '\n'; } }
#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...