QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#716504 | #2549. King's Palace | Tx_Lcy | WA | 0ms | 3560kb | C++14 | 950b | 2024-11-06 15:24:54 | 2024-11-06 15:24:55 |
Judging History
answer
//A tree without skin will surely die.
//A man without face will be alive.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define rep(i,j,k) for(int i=j;i<=k;++i)
#define per(i,j,k) for(int i=j;i>=k;--i)
int const N=2.1e3+10;
int n,m,a[N],b[N],x[N],y[N];
ull an[25][3],val[25];map<ull,int>mp[25];
inline int dfs(int x,ull g){
if (x<0) return 1;
if (mp[x].count(g)) return mp[x][g];
int sm=0;
rep(i,0,2) if (x==n-1 || (!(g>>(x*3+i)&1)))
sm+=dfs(x-1,(g&val[x])|an[x][i]);
return mp[x][g]=sm;
}
inline void solve(){
cin>>n>>m;
if (n==1) return cout<<3<<'\n',void();
rep(i,1,m){
cin>>a[i]>>x[i]>>b[i]>>y[i],--a[i],--b[i];
an[b[i]][y[i]]|=1ull<<(a[i]*3+x[i]);
}
rep(i,0,n-1) val[i]=(1ull<<(3*i))-1;
cout<<dfs(n-1,0)<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int t=1;
// cin>>t;
while (t--) solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3560kb
input:
2 3 1 R 2 R 1 G 2 R 1 B 2 G
output:
9
result:
wrong answer expected '6', found '9'