QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#96466#2921. Land Equalitymariam#WA 2ms3576kbC++172.5kb2023-04-13 21:46:532023-04-13 21:46:56

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 21:46:56]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3576kb
  • [2023-04-13 21:46:53]
  • 提交

answer

//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <set>
#include <unordered_set>
#include <queue>
#include <map>
#include <cmath>
#include <climits>
#include <iomanip>
#include <unordered_map>
#include <stdio.h>
#include <stack>
#include <list>
#include "complex"
#include <assert.h>

#define el '\n'
#define ll long long
#define ld long double
using namespace std;
//
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//
//using namespace __gnu_pbds;

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int N = 2e5 + 5, mod = 1e9 + 7, MAX = 1e9 + 1, M = 1e5;
long double PI = 3.14159265358979323846;;
#define point  complex<long double>
#define vec(a, b) b-a
#define dot(a, b) (long double)(conj(a)*b).real()
#define cross(a, b) (long double)(conj(a)*b).imag()
#define length(a) (hypot((a).imag(), (a).real()))
#define angle(a) atan2((a).imag(), (a).real())
int h, w;
//char a[201][201];
//int dx[] = {0, 0, -1, 1, 1, -1, -1, 1}, dy[] = {-1, 1, 0, 0, 1, -1, 1, -1};
//int dx[] = {-1, -1, 0, 0, 1, 1}, dy[] = {-1, 0, -1, 1, 0, 1};
//
//bool valid(int i, int j) {
//    return (i < h && i >= 0 && j < w && j >= 0);
//}
//
//bool vis[201][201];

ll mul(ll a, ll b) {
    return ((a % mod) * (b % mod)) % mod;
}

ll add(ll a, ll b) {
    return ((a % mod) + (b % mod)) % mod;
}

ll sub(ll a, ll b) {
    return ((((a + mod) % mod) - ((b + mod) % mod)) + mod) % mod;
}

ll fastpow(ll b, ll p) {
    if (p == 0)
        return 1;
    if (p == 1) {
        return b;
    }
    ll hp = fastpow(b, p / 2);
    ll ans = ((hp % mod) * (hp % mod)) % mod;

    if (p % 2) {
        ans = (ans * b) % mod;
    }

    return ans % mod;
}


void m() {
    ll n, m;
    cin >> n >> m;
    ll c0=0,c2=0,c1=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            int in;
            cin>>in;
            c1+=(in==1);
            c2+=(in==2);
            c0+=(in==0);
        }
    }
    //
    if(c0>=2){
        cout<<"0\n";
    }else if(c0==1){
        if(c1)cout<<"1\n";
        else if(c2) cout<<"2\n";
        else cout<<"0\n";
    }else{
        if(!c2){
            cout<<"1\n";
        }else{
            cout<<(1LL<<(c2-1LL))<<"\n";
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //   cin>>t;
    while (t--) {
        m();
    }

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3548kb

input:

1 2
0 1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

1 2
0 2

output:

2

result:

ok single line: '2'

Test #3:

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

input:

1 2
1 2

output:

1

result:

ok single line: '1'

Test #4:

score: -100
Wrong Answer
time: 2ms
memory: 3368kb

input:

2 1
1
1

output:

1

result:

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