QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#393776 | #7303. City United | D_F_S | WA | 22ms | 61176kb | C++14 | 546b | 2024-04-19 11:42:40 | 2024-04-19 11:42:41 |
Judging History
answer
#include<cstdio>
const int U=1594323;int n,m,i,j,x,y,c[4],p[14]={1},e[51],a[U],b[U],f[51][U];
int main()
{
for(i=1;i<14;++i) p[i]=p[i-1]*3;
for(x=0;x<U;++x) a[x]=a[x/3]+(x%3/2), b[x]=b[x/3]+(x%3==1);
for(scanf("%d%d",&n,&m);m--;)
scanf("%d%d",&x,&y), x>y&&(x^=y^=x^=y), e[y]|=1<<y-x-1;
for(i=f[0][0]=1;i<=n;++i)
{
for(x=0;x<U;++x) if(m=f[i-1][x]%4)
{
f[i][y=x*3%U]+=m;
!(e[i]&a[x])&&(f[i][y+1]+=m);
!(e[i]&b[x])&&(f[i][y+2]+=m);
}
}
for(m=-1,x=0;x<U;++x) m+=f[n][x]%4;
printf("%d\n",m%4/2); return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 20244kb
input:
3 2 1 2 2 3
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 7ms
memory: 20140kb
input:
3 3 1 2 2 3 3 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 22ms
memory: 61168kb
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: 15ms
memory: 61176kb
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'