QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#96309#2921. Land Equalityzezoo050#WA 2ms3500kbC++201.2kb2023-04-13 19:14:082023-04-13 19:14:10

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-04-13 19:14:10]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3500kb
  • [2023-04-13 19:14:08]
  • 提交

answer

#include <bits/stdc++.h>
#define endl '\n'
#define el '\n'
#define ll long long
#define fast                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
using namespace std;
long long fp(int b , int p){
    if(p == 0)return 1;
    long long ret = fp(b , p/2);
    ret = ret * ret ;
    if(p%2)ret = ret * b;
    return ret ;
}
void solve()
{
    int n,m; cin >> n >> m;
    int grid[n][m], ones = 0, twos = 0, zeroes = 0;
    for(int i = 0;i < n;i++)
    {
        for(int j = 0;j<m;j++){
            cin >> grid[i][j];
            if(grid[i][j] == 1)ones++;
            else if(grid[i][j] == 2)twos++;
            else zeroes++;
        }
    }
    if(zeroes == 0)
    {
        if(twos)
        {
            ll f = twos / 2, s = twos / 2 + (twos % 2);
            cout<<fp(2,s) - fp(2,f)<<el;
        }else{
            cout<<0<<el;
        }
    }else if(zeroes == 1){
        if(ones)cout<<1<<el;
        else if (twos)cout<<2<<el;
        else cout<<0<<el;
    }
    else{
        cout<<0<<el;
    }
}
int main()
{
    fast;
    int tc = 1;
    // cin >> tc;
    while (tc--)
    {
        solve();
    }
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 3344kb

input:

1 2
0 1

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

1 2
0 2

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3348kb

input:

1 2
1 2

output:

1

result:

ok single line: '1'

Test #4:

score: 0
Accepted
time: 2ms
memory: 3500kb

input:

2 1
1
1

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 1ms
memory: 3328kb

input:

2 1
0
0

output:

0

result:

ok single line: '0'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3328kb

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: 3328kb

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: 2ms
memory: 3332kb

input:

2 3
0 1 2
1 1 2

output:

1

result:

ok single line: '1'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3328kb

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: 2ms
memory: 3348kb

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: -100
Wrong Answer
time: 1ms
memory: 3328kb

input:

1 3
0 1 2

output:

1

result:

wrong answer 1st lines differ - expected: '2', found: '1'