QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#393760 | #7303. City United | D_F_S | WA | 5ms | 5196kb | C++14 | 497b | 2024-04-19 11:08:00 | 2024-04-19 11:08:01 |
Judging History
answer
#include<cstdio>
int n,m,i,j,x,y,c[4],p[13]={1},e[51][13],f[51][531441];
int main()
{
for(i=1;i<13;++i) p[i]=p[i-1]*3; for(scanf("%d%d",&n,&m);m--;)
scanf("%d%d",&x,&y), x>y&&(x^=y^=x^=y), e[y][y-x-1]=1;
for(i=f[0][0]=1;i<=n;++i)
{
for(x=0;x<p[12];++x) if(m=f[i-1][x]%4)
{
for(c[1]=c[2]=j=0;j<12;++j) c[3-(x/p[j])%3]|=e[i][j];
f[i][y=x*3%p[12]]+=m; for(j=1;j<3;++j) f[i][y+j]+=(1-c[j])*m;
}
}
for(m=0,x=1;x<p[12];++x) m+=f[n][x]; printf("%d\n",m%4/2); return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 1612kb
input:
3 2 1 2 2 3
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 1ms
memory: 1628kb
input:
3 3 1 2 2 3 3 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 3ms
memory: 5196kb
input:
15 31 9 5 14 5 2 7 5 15 11 14 11 9 2 6 3 4 12 1 6 8 3 5 11 10 15 6 4 1 1 2 8 9 6 12 14 10 13 2 4 5 3 8 3 15 11 6 7 5 4 6 11 2 13 15 3 2 8 4 6 13 7 10
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: -100
Wrong Answer
time: 5ms
memory: 4148kb
input:
15 92 10 9 15 7 11 1 7 2 12 10 1 12 4 13 1 4 11 5 1 2 4 3 1 9 15 4 11 7 14 1 8 7 8 12 7 4 10 14 7 13 6 13 4 12 11 10 13 8 13 15 10 7 2 14 12 13 14 5 8 4 12 9 7 9 15 10 10 4 11 15 13 10 6 15 8 9 2 8 11 12 5 4 1 6 2 9 10 1 5 6 14 12 5 13 5 10 6 9 15 8 12 15 10 2 5 7 4 6 2 11 12 3 15 9 9 3 3 10 5 2 12 ...
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'