ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211953 | #3815. 种树 | KLLD1371 | 10 | 0ms | 1244kb | C++ | 701b | 2024-10-13 09:05:35 | 2024-10-13 12:53:00 |
answer
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 5;
bool vis[20][20];
bool r[20];
bool c[20];
map<int, int>md, sd;
int ans, n , m , k;
bool check(int x, int y)
{
return r[x] == 0 and c[y] == 0;
}
void setVis(int x, int y, int z)
{
vis[x][y] = z;
r[x] = z;
c[y] = z;
md[x + y] = z;
sd[x - y] = z;
}
void DFS(int x , int k)
{
if (x == k + 1)
{
ans++;
return;
}
for (int i = 1; i <= m; i++)
{
if (check(x, i))
{
setVis(x, i, 1);
DFS(x + 1 , k);
setVis(x, i, 0);
}
}
}
int main()
{
cin >> n >> m >> k;
for(int i = 1 ; i <= n - k + 1 ; i ++){
DFS(i , k + i - 1);
}
cout << ans;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 0ms
memory: 1240kb
input:
2 2 1
output:
4
result:
ok 1 number(s): "4"
Test #2:
score: 0
Wrong Answer
time: 0ms
memory: 1244kb
input:
2 3 2
output:
6
result:
wrong answer 1st numbers differ - expected: '8', found: '6'
Test #3:
score: 0
Wrong Answer
time: 0ms
memory: 1244kb
input:
4 4 2
output:
36
result:
wrong answer 1st numbers differ - expected: '96', found: '36'
Test #4:
score: 0
Wrong Answer
time: 0ms
memory: 1200kb
input:
4 4 5
output:
0
result:
wrong answer 1st numbers differ - expected: '304', found: '0'
Test #5:
score: 0
Wrong Answer
time: 0ms
memory: 1240kb
input:
3 4 3
output:
24
result:
wrong answer 1st numbers differ - expected: '84', found: '24'
Test #6:
score: 0
Wrong Answer
time: 0ms
memory: 1244kb
input:
3 5 2
output:
40
result:
wrong answer 1st numbers differ - expected: '83', found: '40'
Test #7:
score: 0
Wrong Answer
time: 0ms
memory: 1240kb
input:
3 5 3
output:
60
result:
wrong answer 1st numbers differ - expected: '215', found: '60'
Test #8:
score: 0
Wrong Answer
time: 0ms
memory: 1204kb
input:
3 5 4
output:
0
result:
wrong answer 1st numbers differ - expected: '276', found: '0'
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 1204kb
input:
3 5 5
output:
0
result:
wrong answer 1st numbers differ - expected: '174', found: '0'
Test #10:
score: 0
Wrong Answer
time: 0ms
memory: 1200kb
input:
4 3 5
output:
0
result:
wrong answer 1st numbers differ - expected: '18', found: '0'