QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#547863 | #8538. Infinite Adventure | -Ofast# | 5.555556 | 1ms | 3732kb | C++17 | 405b | 2024-09-05 11:43:35 | 2024-09-05 11:43:35 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N=2e3+10;
int n,q,t[N],c[N][N],v,T,s;
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
cin>>n>>q;
for(int i=1;i<=n;i++)
cin>>t[i],t[i]--;
for(int i=1;i<=n;i++)
for(int j=0;j<=t[i];j++)cin>>c[i][j];
while(q--){
cin>>v>>T>>s;
while(s--){
v=c[v][T&t[v]];
T++;
}
cout<<v<<"\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Pretests
Final Tests
Test #1:
score: 5.55556
Accepted
time: 0ms
memory: 3608kb
input:
5 4 1 2 1 2 8 2 3 4 4 2 3 5 5 5 5 5 1 5 5 2 4 3 3 3 6 5 3 2 5 3 7
output:
2 2 5 4
result:
ok 4 lines
Test #2:
score: 0
Time Limit Exceeded
input:
5 5 1 2 1 2 8 2 3 4 4 2 3 5 5 5 5 5 1 5 5 2 4 3 3 2 6 5 3 2 5 3 7 5 3 1000000000000000000
output:
result:
Test #3:
score: 0
Wrong Answer
time: 1ms
memory: 3732kb
input:
8191 50000 4096 2048 2048 1024 1024 1024 1024 512 512 512 512 512 512 512 512 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 128 64 64 64 64 64 64 64 64 64 64 ...
output:
0 0 0
result:
wrong answer 1st lines differ - expected: '6024', found: '0'
Test #4:
score: 0
Time Limit Exceeded
input:
342 49996 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 4 1 1 1 1 1 1 1 16 1 1 1 16 1 1 1 1 1 1 1 1 4 1 1 4 1 1 1 1 1 4 4 1 1 1 4 1 4 4 1 4 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 4 1 1 1 1 1 1 4 1 1 4 1 4 1 1 1 1 1 1 1 1 1 16 1 1 1 1 1 1 4 1 1 1 4 1 1 1 4 16 4 1 1 1 1 1 1 4 1 1 1 1 1 1 16 4 4 4 1 1 1 1 4 1 4 1 1 1 ...
output:
result:
Test #5:
score: 0
Time Limit Exceeded
input:
342 49991 1 4 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 4 1 1 64 1 4 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 1 4 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 16 1 1 1 4 4 1 1 1 16 1 1 1 1 64 1 1 1 4 1 1 1 1 1 1 1 1 1 4 1 1 4 1 1 1 1 1 4 1 4 1 1 1 1 1 1 1 1 1 4 16 16 16 1 256 1 1 1 1 1 4 4 4 1 1 1 4 1 4 4 1 1 4 1 1 ...
output:
result:
Test #6:
score: 0
Wrong Answer
time: 1ms
memory: 3668kb
input:
2359 49991 1 1 2 2 2 2 1 1 2 4 1 2 1 1 1 2 1 4 2 2 1 1 1 4 1 1 1 1 2 1 1 8 1 2 2 1 1 4 2 1 1 4 2 2 4 8 1 4 1 2 4 8 1 2 4 1 2 1 1 4 4 1 2 1 2 8 1 1 1 4 1 2 4 1 4 1 1 1 2 1 1 1 4 1 4 1 1 1 2 2 1 2 2 1 2 1 2 2 4 1 1 1 4 1 2 1 1 4 1 1 2 1 4 1 2 4 1 4 1 8 1 1 4 8 2 4 2 1 1 4 1 4 1 4 1 4 2 2 1 1 8 8 1 1 2...
output:
0
result:
wrong answer 1st lines differ - expected: '536', found: '0'
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
2292 49996 1 1 8 1 1 1 2 1 2 1 1 1 1 8 1 1 1 1 2 1 4 2 1 1 1 1 2 1 8 8 4 1 4 1 1 2 1 2 4 1 1 2 2 2 1 4 4 4 2 1 1 1 2 1 1 1 2 1 1 2 2 1 1 1 1 4 8 1 8 1 1 1 1 1 1 4 4 1 8 1 1 1 2 4 1 2 4 2 4 2 4 4 2 2 1 1 1 2 1 1 2 1 8 1 1 1 1 1 1 1 1 4 2 2 2 4 1 1 4 1 2 1 4 4 1 2 2 2 1 2 2 2 1 1 1 1 2 1 1 4 1 1 2 1 2...
output:
result:
wrong answer 1st lines differ - expected: '948', found: ''
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 3708kb
input:
2312 49992 4 2 1 1 4 1 1 1 1 4 2 2 2 1 1 1 1 1 1 4 1 4 1 1 8 2 2 8 4 1 8 2 1 2 1 1 2 1 1 1 2 2 4 1 1 1 1 4 1 2 2 2 1 2 4 1 1 4 1 1 1 1 1 4 1 2 2 4 1 1 2 1 1 8 1 2 1 1 1 2 2 2 1 1 1 4 1 1 2 1 1 1 1 1 2 1 1 2 2 1 4 4 1 1 4 1 4 1 4 2 2 1 4 1 2 2 1 1 2 2 2 2 2 1 2 2 1 2 1 4 1 2 1 2 2 1 1 1 1 4 1 1 2 1 1...
output:
result:
wrong answer 1st lines differ - expected: '94', found: ''
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 3652kb
input:
16386 49994 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
result:
wrong answer 1st lines differ - expected: '6023', found: ''
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 3568kb
input:
16386 49995 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
result:
wrong answer 1st lines differ - expected: '7961', found: ''
Test #11:
score: 0
Wrong Answer
time: 0ms
memory: 3532kb
input:
19859 49993 4 1 1 1 2 1 1 2 1 1 1 2 16 2 1 2 1 1 2 2 1 1 1 2 4 4 1 2 2 4 1 1 1 2 1 1 1 1 2 2 2 1 8 1 1 4 1 4 2 1 4 1 2 1 4 1 1 8 2 4 1 2 2 4 1 8 1 1 1 1 2 1 1 1 1 32 2 4 2 4 1 2 4 2 2 4 1 4 2 1 16 1 2 4 1 1 1 2 1 2 1 2 1 1 2 1 4 2 1 4 1 8 4 1 2 1 4 1 1 1 1 1 8 2 1 2 4 2 2 1 1 1 1 2 2 1 1 16 1 32 2 4...
output:
result:
wrong answer 1st lines differ - expected: '14409', found: ''
Test #12:
score: 0
Wrong Answer
time: 0ms
memory: 3728kb
input:
19960 49997 2 2 2 16 4 4 2 1 2 1 1 1 1 1 4 1 1 1 8 1 32 1 1 1 1 1 1 2 1 2 1 1 1 1 32 1 1 8 2 2 1 4 2 1 2 2 1 1 8 1 1 1 2 2 4 1 2 4 1 4 2 2 1 1 1 1 16 1 4 2 8 16 1 1 1 4 1 4 1 1 16 1 4 1 8 4 2 1 2 2 4 2 1 2 4 1 2 8 2 1 8 1 2 2 1 2 2 1 1 1 1 2 4 4 4 1 1 2 2 4 2 2 1 1 1 4 1 1 1 2 1 1 2 2 4 1 1 1 1 1 1 ...
output:
0 0 0 0 1 0 1
result:
wrong answer 1st lines differ - expected: '18257', found: '0'
Test #13:
score: 0
Wrong Answer
time: 0ms
memory: 3672kb
input:
19898 49993 8 8 1 1 1 2 2 2 1 1 16 2 4 4 1 4 2 1 1 2 1 8 2 2 1 4 2 1 32 1 1 1 8 1 1 1 2 1 1 4 1 16 4 2 1 1 2 2 1 2 1 4 2 1 1 4 2 1 1 16 1 1 4 1 1 1 4 2 8 16 2 2 2 1 4 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 1 16 4 2 1 1 8 1 1 8 1 4 8 1 1 4 4 1 4 1 2 4 4 8 2 1 1 1 8 4 1 1 4 1 16 2 1 2 4 8 2 1 1 1 1 2 2 1 2 2 1...
output:
0 0 0
result:
wrong answer 1st lines differ - expected: '18432', found: '0'
Test #14:
score: 0
Wrong Answer
time: 0ms
memory: 3732kb
input:
20050 49995 4 4 2 1 2 1 1 2 1 1 1 4 1 1 1 1 1 1 1 1 2 1 2 1 1 8 1 1 2 2 2 1 1 8 1 4 2 2 8 1 2 1 2 4 2 1 1 1 1 2 2 1 2 1 1 1 1 1 2 1 16 1 2 2 2 2 1 1 1 1 1 1 1 1 1 2 1 1 1 32 16 2 1 16 2 2 1 4 2 8 1 1 16 8 1 2 4 1 1 2 2 2 1 2 1 2 1 1 4 1 1 2 1 1 2 1 1 1 4 4 1 2 1 1 1 1 1 2 2 1 1 1 2 2 1 2 1 1 4 16 2 ...
output:
0
result:
wrong answer 1st lines differ - expected: '10008', found: '0'
Test #15:
score: 0
Wrong Answer
time: 0ms
memory: 3528kb
input:
21377 49995 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 ...
output:
result:
wrong answer 1st lines differ - expected: '13591', found: ''
Test #16:
score: 0
Wrong Answer
time: 0ms
memory: 3600kb
input:
21609 49996 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 4 1 1 1 4 1 1 1 1 1 1 1 1 2 1 2 1 1 1 1 1 1 2 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1
result:
wrong answer 1st lines differ - expected: '5790', found: '1'
Test #17:
score: 0
Wrong Answer
time: 0ms
memory: 3660kb
input:
21384 50000 1 1 1 8 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 32 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 2 1 1 1 1 1 1 2 4 8 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 2 1 2 1 4 1 1 1 1 1 ...
output:
result:
wrong answer 1st lines differ - expected: '18285', found: ''
Test #18:
score: 0
Wrong Answer
time: 0ms
memory: 3648kb
input:
21120 49998 1 1 1 1 1 1 1 1 2 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 16 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 1 1 2 1 1 2 8 1 1 1 1 1 1 1 1 16 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 2 1 1 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 1 1 1 ...
output:
result:
wrong answer 1st lines differ - expected: '18536', found: ''