QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#430072 | #8771. Dihedral Group | Kevin5307 | WA | 0ms | 3740kb | C++20 | 513b | 2024-06-03 13:36:45 | 2024-06-03 13:36:48 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int pos[100100];
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
int x;
cin>>x;
pos[x]=i;
}
vector<int> vec;
while(m--)
{
int x;
cin>>x;
vec.push_back(pos[x]);
}
for(int i=1;i<m-1;i++)
if((vec[i]*2-vec[i-1]-vec[i+1])%n)
{
cout<<"0\n";
return 0;
}
if(vec.size()>1)
{
int val=(vec[1]-vec[0]+n)%n;
if(val!=1&&val!=n-1)
{
cout<<"0\n";
return 0;
}
}
cout<<"1\n";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3500kb
input:
3 3 1 2 3 1 3 2
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3740kb
input:
3 1 1 2 3 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
4 2 1 2 3 4 1 3
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
4 4 1 2 3 4 2 3 4 1
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
4 4 1 2 3 4 3 2 1 4
output:
1
result:
ok single line: '1'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 3 1 3 5 4 2 2 1 3
output:
1
result:
ok single line: '1'
Test #7:
score: -100
Wrong Answer
time: 0ms
memory: 3500kb
input:
5 4 1 3 5 4 2 2 1 5 3
output:
1
result:
wrong answer 1st lines differ - expected: '0', found: '1'