QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96333#2921. Land EqualityAbdelrahman_ahmed7#WA 2ms3536kbC++171.4kb2023-04-13 19:46:242023-04-13 19:46:26

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:46:26]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3536kb
  • [2023-04-13 19:46:24]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
#define el '\n'
#define all(a) a.begin(),a.end()

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<typename T>

using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const ll N=1e5+5,mod=1e9+7;


void solve(ll t) {
    ll n ,m ;
    cin >> n >> m;

    short int arr[n][m];

    int counts[3] = {0,0,0};
    for (ll i = 0 ; i < n ; i ++)
    {
        for (ll j = 0 ,x ; j < m ; j ++)
        {
            cin >> x;
            arr[i][j]  = x;
            counts[x]++;
        }
    }

    if (counts[0] >= 2)
    {
        cout << 0 ;
        return;
    }

    if (counts[0] == 1)
    {
        if (counts[1] >= 1) {cout << 1; return;}
        if (counts[2] >= 1) {cout << 2; return;}
    }

    // zeros == 0

    if (counts[2] % 2 == 0)
    {
        cout << 0;
        return;
    }

    ll half = counts[2]/2;
    ll second_half = half  + 1;

    ll diff = second_half - half;

    unsigned long long a = (unsigned long long )1LL*(1LL << second_half) - (unsigned long long )1LL*(1LL << half);
    cout << a ;

}
int main() {
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

    ll t;
    //cin >> t;
    t = 1;
    for (ll i = 0 ; i < t ; i ++)
    {
        solve(t);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 2
0 1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

1 2
0 2

output:

2

result:

ok single line: '2'

Test #3:

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

input:

1 2
1 2

output:

1

result:

ok single line: '1'

Test #4:

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

input:

2 1
1
1

output:

0

result:

ok single line: '0'

Test #5:

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

input:

2 1
0
0

output:

0

result:

ok single line: '0'

Test #6:

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

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

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: 1ms
memory: 3532kb

input:

2 3
0 1 2
1 1 2

output:

1

result:

ok single line: '1'

Test #9:

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

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

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: 0ms
memory: 3296kb

input:

1 3
0 1 2

output:

1

result:

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