Submission #991016

#TimeUsernameProblemLanguageResultExecution timeMemory
991016PacybwoahPassport (JOI23_passport)C++17
0 / 100
0 ms348 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,bmi,bmi2") #include<iostream> #include<vector> #include<utility> #include<map> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pair<int, int>> vec(n + 1); for(int i = 1; i <= n; i++) cin >> vec[i].first >> vec[i].second; int q; cin >> q; vector<int> maxi(n + 1); for(int i = 1; i <= n; i++) maxi[i] = max(maxi[i - 1], vec[i].second); while(q--){ int a; cin >> a; int r = vec[1].second, ans = 1; while(r < n && ans <= n + 1){ r = maxi[r]; ans++; } if(ans == n + 1) cout << "-1\n"; else cout << ans << "\n"; } } // g++ -std=gnu++20 pC.cpp -o run -Wall -Wextra -fsanitize=undefined -fsanitize=address
#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...