UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212063#3815. 种树Kongleqi201302ms2208kbC++1.2kb2024-10-13 10:51:172024-10-13 12:55:20

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn=101;
int n,m,k;
bool a[maxn][maxn][maxn];
void copyx(int layer1,int layer2){
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            a[i][j][layer1] = a[i][j][layer2];  
        }
    }
}
int f(int layer,int beginx,int beginy){
    cout<<"init at "<<beginx<<" "<<beginy<<endl;
    int cnt=0;
    int p=0;
    for(int i=beginx;i<=n;i++){
        for(int j=beginy;j<=m;j++){
            if(a[i][j][layer] == false && a[i+1][j][layer] == false && a[i-1][j][layer] == false && a[i][j+1][layer] == false && a[i][j-1][layer] == false){
                cout<<i<<" "<<j<<" "<<layer<<" yes"<<endl;
                a[i][j][layer] = false;
                cnt++;
                copyx(layer+1,layer);
                a[i][j][layer+1] = true;
                cout<<"next layer"<<endl;
                if(f(layer+1,i,j) == k){
                    cout<<"y"<<endl;
                    p++;
                }
            }
        }
    }
    if(cnt == k){
        p++;
        cout<<"Y"<<endl;
    }
    return p;
}
int main(){
    memset(a,0,sizeof(a));
    cin>>n>>m>>k;
    cout<<f(0,1,1);
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 2204kb

input:

2 2 1

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
2 2 1 yes
next layer
init at 2 2
Y
y
1 2 0 yes
next lay...

result:

wrong output format Expected integer, but "init" found

Test #2:

score: 0
Wrong Answer
time: 2ms
memory: 2204kb

input:

2 3 2

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
2 2 1 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #3:

score: 0
Wrong Answer
time: 0ms
memory: 2208kb

input:

4 4 2

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
2 4 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #4:

score: 0
Wrong Answer
time: 0ms
memory: 2208kb

input:

4 4 5

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
2 4 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 2208kb

input:

3 4 3

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
2 4 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #6:

score: 0
Wrong Answer
time: 0ms
memory: 2204kb

input:

3 5 2

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
1 5 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #7:

score: 0
Wrong Answer
time: 0ms
memory: 2204kb

input:

3 5 3

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
1 5 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #8:

score: 0
Wrong Answer
time: 0ms
memory: 2204kb

input:

3 5 4

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
1 5 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 2204kb

input:

3 5 5

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
1 5 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found

Test #10:

score: 0
Wrong Answer
time: 0ms
memory: 2208kb

input:

4 3 5

output:

init at 1 1
1 1 0 yes
next layer
init at 1 1
1 3 1 yes
next layer
init at 1 3
3 3 2 yes
next layer
i...

result:

wrong output format Expected integer, but "init" found