Submission #827019

#TimeUsernameProblemLanguageResultExecution timeMemory
827019HanksburgerPassport (JOI23_passport)C++17
6 / 100
31 ms2768 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, ind=1, mx=1, ans=1; cin >> n; for (int i=1; i<=n; i++) { int l, r; cin >> l >> r; mx=max(mx, r); if (i==ind) { if (mx==ind) { cout << -1; return 0; } if (mx==n) { cout << ans; return 0; } ans++; ind=mx; } } }
#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...