#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
19032 KB |
Output is correct |
2 |
Incorrect |
24 ms |
19544 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
19032 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
10 ms |
19544 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
19032 KB |
Output is correct |
2 |
Incorrect |
24 ms |
19544 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |