QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#716236 | #2549. King's Palace | BINYU | WA | 0ms | 3692kb | C++14 | 787b | 2024-11-06 14:43:26 | 2024-11-06 14:43:26 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 22,M = 10000;
int n,m,a[M + 5],b[M + 5],c[M + 5],d[M + 5],p[N + 5],flag[N + 5][3];
vector <pair <int,int> > v[N + 5][3];
ll dfs(int x)
{
if(x == n + 1)return 1;
int cnt = 0;ll res = 0;
for(int i = 0;i < 3;i++)
{
p[x] = i;
if(flag[x][i])continue;
if(!v[x][i].size())cnt++;
else
{
for(auto now : v[x][i])
flag[now.first][now.second]++;
res += dfs(x + 1);
for(auto now : v[x][i])
flag[now.first][now.second]--;
}
}
if(cnt)p[x] = -1,res += cnt * dfs(x + 1);
return res;
}
int main()
{
scanf("%d %d",&n,&m);
for(int i = 1;i <= m;i++)
scanf("%d %d %d %d",&a[i],&b[i],&c[i],&d[i]),
v[a[i]][b[i]].push_back({c[i],d[i]});
cout<<dfs(1);
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3692kb
input:
2 3 1 R 2 R 1 G 2 R 1 B 2 G
output:
9
result:
wrong answer expected '6', found '9'