Submission #854275

#TimeUsernameProblemLanguageResultExecution timeMemory
854275PagodePaivaThrough Another Maze Darkly (CCO21_day1problem3)C++17
0 / 25
24 ms19544 KiB
#include<bits/stdc++.h> #define N 800010 #define int long long using namespace std; vector <int> g[N]; int32_t main(){ int n, q; cin >> n >> q; for(int i = 1;i <= n;i++){ int t; cin >> t; while(t--){ int x; cin >> x; g[i].push_back(x); } } for(int i = 0;i < q;i++){ int x; cin >> x; x %= (2*n-2); if(0 <= x and x <= n-1){ cout << x+1 << '\n'; } else{ x -= n-1; cout << n-x << '\n'; } } 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...