This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |