QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#335577 | #2921. Land Equality | amshale | WA | 1ms | 3876kb | C++20 | 1.3kb | 2024-02-23 16:26:50 | 2024-02-23 16:26:51 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main() {
int rows,columns;
scanf("%d",&rows);
scanf("%d",&columns);
int zeroes=0;
int doubles=0;
int freeones=0;
int ones=0;
int curr_num;
for(int i=0;i<rows;i++){
for(int j=0;j<columns;j++){
scanf("%d",&curr_num);
if(curr_num==0){
zeroes++;
}
else if(curr_num==2){
doubles++;
}
else{
ones++;
if((columns==1&&(i==0||i==rows-1))||rows==1&&(j==0||j==columns-1)){
freeones++;
}
}
}
}
if((columns==1||rows==1)&&zeroes==1){
if(freeones>0){
printf("1\n");
return 0;
}else{
printf("2\n");
return 0;
}
}else if(zeroes==0){
if(doubles%2==0){
printf("0\n");
return 0;
}
else{
printf("%d\n",int(pow(2,(doubles/2))));
return 0;
}
}
else if(zeroes==1){
if(ones>0){
printf("1\n");
}
else{
printf("2\n");
}
}
else{
printf("0\n");
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
1 2 0 1
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3868kb
input:
1 2 0 2
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 2 1 2
output:
1
result:
ok single line: '1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
2 1 1 1
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
2 1 0 0
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
5 5 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 2 1 2 2 2 2 2 2 2
output:
0
result:
ok single line: '0'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
5 5 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 2 1 1 2 2 2 2 2 2
output:
512
result:
ok single line: '512'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
2 3 0 1 2 1 1 2
output:
1
result:
ok single line: '1'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
2 6 0 2 2 1 2 2 1 1 1 1 2 2
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
4 4 2 2 2 2 2 1 2 2 2 0 2 2 2 2 2 2
output:
1
result:
ok single line: '1'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3848kb
input:
1 3 0 1 2
output:
2
result:
ok single line: '2'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
1 6 2 1 2 0 1 2
output:
2
result:
ok single line: '2'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
6 1 2 1 2 0 1 2
output:
2
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
1 5 0 1 1 1 2
output:
2
result:
ok single line: '2'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
1 6 2 1 2 0 2 1
output:
1
result:
ok single line: '1'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
1 6 1 1 2 0 1 2
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
6 1 2 1 2 0 2 1
output:
1
result:
ok single line: '1'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
1 10 2 1 1 1 0 0 1 1 1 2
output:
0
result:
ok single line: '0'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
1 10 1 2 0 2 2 2 2 0 2 1
output:
0
result:
ok single line: '0'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
1 10 0 1 1 1 2 2 1 1 1 0
output:
0
result:
ok single line: '0'
Test #21:
score: -100
Wrong Answer
time: 0ms
memory: 3848kb
input:
8 8 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
output:
-2147483648
result:
wrong answer 1st lines differ - expected: '2147483648', found: '-2147483648'