QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#326861 | #7303. City United | Forg1weN | WA | 1ms | 3884kb | C++14 | 917b | 2024-02-14 11:25:34 | 2024-02-14 11:25:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn=1<<14;
int n,m,ans;
int f[maxn];
int G[55][55];
void pt() {
for(int i=1;i<=(1<<12)-1;i++)
ans=(ans+f[i]/2)%2;
printf("%d",ans);
}
int main() {
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++) {
int u,v;
scanf("%d%d",&u,&v);
G[u][v]=G[v][u]=1;
}
for(int i=1;i<=min(n,12);i++) {
int tot=(1<<i-1)-1;
f[1<<(i-1)]=2;
for(int j=1;j<=tot;j++) {
bool pd=0;
for(int k=1;k<i;k++)
if((j>>k-1&1)&&G[i][k])pd=1;
if(pd==1)f[j+(1<<(i-1))]=f[j];
else f[j+(1<<(i-1))]=f[j]*2%4;
}
}
if(n<=12)pt();
else {
int tot=(1<<12)-1;
for(int i=13;i<=n;i++) {
for(int j=1;j<=tot;j++) {
bool pd=0;
for(int k=1;k<=12;k++)
if((j>>k-1&1)&&G[i][i-12+k])pd=1;
if(pd==1)f[(1<<11)+(j>>1)]=f[j];
else f[(1<<11)+(j>>1)]=f[j]*2%4;
}
}
pt();
}
return 0;
}
/*
3 2
1 2
2 3
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3864kb
input:
3 2 1 2 2 3
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3864kb
input:
3 3 1 2 2 3 3 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: -100
Wrong Answer
time: 1ms
memory: 3884kb
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:
0
result:
wrong answer 1st numbers differ - expected: '1', found: '0'