QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#57726#2921. Land Equalitywtcherr#WA 2ms3720kbC++202.4kb2022-10-22 18:34:342022-10-22 18:34:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-10-22 18:34:35]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3720kb
  • [2022-10-22 18:34:34]
  • 提交

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
#define f first
#define s second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define IO ios_base::sync_with_stdio(0), cin.tie(0)
const int mod = 1e9 + 7;
template <typename T>
void readArray(vector<T> &A)
{
    for (T &i : A)
        cin >> i;
}
template <typename T>
void readArray(vector<vector<T>> &A)
{
    for (vector<T> &i : A)
        readArray(i);
}
template <typename T>
void printArray(vector<T> A)
{
    for (T i : A)
        cout << i << " ";
    cout << endl;
}
ll fastPow(ll a, ll b, ll m = mod)
{
    a %= m;
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
bool isPrime(ll n, int iter = 5)
{
    if (n < 4)
        return n == 2 || n == 3;
    for (int i = 0; i < iter; i++)
    {
        int a = 2 + rand() % (n - 3);
        if (fastPow(a, n - 1, n) != 1)
            return false;
    }
    return true;
}
ll inv(ll n, ll m = mod)
{
    return fastPow(n, m - 2);
}
ll mul(ll a, ll b, ll m = mod)
{
    return (a * b) % m;
}
ll add(ll a, ll b, ll m = mod)
{
    return (a + b + m) % m;
}
void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> cnt(3);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            int in;
            cin >> in;
            cnt[in]++;
        }
    }
    if (cnt[0] >= 2)
        cout << 0;
    else if (cnt[0] == 1)
    {
        if (cnt[1])
            cout << 1;
        else if (cnt[2])
            cout << 2;
        else
            cout << 0;
    }
    else
    {
        if (cnt[2] % 2 == 0)
            cout << 0;
        else
        {
            cout << (1ll << (cnt[2] / 2));
        }
    }
}
void trials()
{
    int t, tt;
    for (cin >> t, tt = t; t--; cout << endl)
    {
        // cout << "Case #" << tt - t << ": ";
        solve();
    }
}
int main()
{
    // freopen("","r",stdin);
    IO;
    solve();
}

詳細信息

Test #1:

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

input:

1 2
0 1

output:

1

result:

ok single line: '1'

Test #2:

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

input:

1 2
0 2

output:

2

result:

ok single line: '2'

Test #3:

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

input:

1 2
1 2

output:

1

result:

ok single line: '1'

Test #4:

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

input:

2 1
1
1

output:

0

result:

ok single line: '0'

Test #5:

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

input:

2 1
0
0

output:

0

result:

ok single line: '0'

Test #6:

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

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

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

input:

2 3
0 1 2
1 1 2

output:

1

result:

ok single line: '1'

Test #9:

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

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

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

input:

1 3
0 1 2

output:

1

result:

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