QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#463121 | #7303. City United | Lynkcat | WA | 245ms | 28596kb | C++20 | 1.5kb | 2024-07-04 14:03:13 | 2024-07-04 14:03:14 |
Judging History
answer
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define mod 998244353
#define sz(x) ((int)((x).size()))
#define int ll
// #define N
using namespace std;
const int N=55;
int n,m;
poly G[N];
int pw[15];
int dp[1594323],tmp[1594323];
void BellaKira()
{
cin>>n>>m;
for (int i=1;i<=m;i++)
{
int x,y;
cin>>x>>y;
if (x>y) swap(x,y);
G[y].push_back(x);
}
pw[0]=1;
for (int i=1;i<=13;i++) pw[i]=pw[i-1]*3;
dp[0]=1;
for (int i=1;i<=n;i++)
{
memset(tmp,0,sizeof(tmp));
for (int j=0;j<pw[13];j++)
tmp[j]=dp[j/3];
for (int j=0;j<pw[13];j++)
if (dp[j])
{
int tx=1,ty=1;
for (auto u:G[i])
{
int x=13-(i-u);
if ((j/pw[x])%3==1) tx=0;
else if ((j/pw[x])%3==2) ty=0;
}
if (tx) tmp[j/3+pw[12]]=(tmp[j/3+pw[12]]+dp[j])&3;
if (ty) tmp[j/3+pw[12]+pw[12]]=(tmp[j/3+pw[12]+pw[12]]+dp[j])&3;
}
memcpy(dp,tmp,sizeof(dp));
}
int ans=0;
for (int i=0;i<pw[13];i++) ans=(ans+dp[i])&3;
ans=(ans+3)%4;
cout<<ans/2<<'\n';
}
signed main()
{
IOS;
cin.tie(0);
int T=1;
while (T--)
{
BellaKira();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 12ms
memory: 28596kb
input:
3 2 1 2 2 3
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: 0
Accepted
time: 15ms
memory: 28596kb
input:
3 3 1 2 2 3 3 1
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 110ms
memory: 28504kb
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: 245ms
memory: 28580kb
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'