QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#351796 | #7303. City United | ttest | WA | 5ms | 16156kb | C++14 | 1.6kb | 2024-03-12 15:01:46 | 2024-03-12 15:01:48 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define fir first
#define sec second
#define pii pair<int,int>
#define isz(v) (int)(v.size())
using namespace std;
const int maxn=55;
const int maxs=1600005;
const int lim=13;
const int inf=0x3f3f3f3f;
const int p13=1594323;
namespace Solve {
int pw[maxn];
bool e[maxn][maxn];
int cur;
int f[maxs];
int g[maxs];
void clear() {
}
void add(int &x,int y) {
x=(x+y)&3;
}
void dfs(int x,int s,bool p,bool q) {
if(!x) {
if(p) {
add(g[(s*3)%p13+0],f[s]);
}
if(q) {
add(g[(s*3)%p13+1],f[s]);
}
add(g[(s*3)%p13+2],f[s]);
return ;
}
dfs(x-1,s*3+0,p,e[cur][x]?false:q);
dfs(x-1,s*3+1,e[cur][x]?false:p,q);
dfs(x-1,s*3+2,p,q);
}
void main(int tid) {
int n,m;
cin>>n>>m;
pw[0]=1;
for(int i=1;i<=lim;i++) {
pw[i]=3*pw[i-1];
}
for(int i=1;i<=m;i++) {
int x,y;
cin>>x>>y;
if(x>y) {
swap(x,y);
}
e[y][y-x]=true;
}
memset(f,0,sizeof(f));
f[p13-1]=1;
for(cur=1;cur<=n;cur++) {
memset(g,0,sizeof(g));
// dfs(lim,0,true,true);
memcpy(f,g,sizeof(f));
}
int ans=0;
for(int s=0;s<=p13-1;s++) {
add(ans,f[s]);
}
cout<<(ans>>1)<<"\n";
}
void init() {
}
}
signed main() {
// freopen("data.in","r",stdin);
// freopen("data.out","w",stdout);
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int T=1;
// cin>>T;
Solve::init();
for(int t=1;t<=T;t++) {
Solve::main(t);
Solve::clear();
}
#ifndef ONLINE_JUDGE
cerr<<"Time: "<<clock()<<"ms\n";
#endif
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 16144kb
input:
3 2 1 2 2 3
output:
0
result:
ok 1 number(s): "0"
Test #2:
score: -100
Wrong Answer
time: 5ms
memory: 16156kb
input:
3 3 1 2 2 3 3 1
output:
0
result:
wrong answer 1st numbers differ - expected: '1', found: '0'