QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#112617#6368. Zenyk, Marichka and Interesting Game8BQube#WA 2ms3392kbC++141.2kb2023-06-12 16:15:232023-06-12 16:15:26

Judging History

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

  • [2024-07-31 22:32:12]
  • hack成功,自动添加数据
  • (/hack/769)
  • [2024-07-31 22:31:27]
  • hack成功,自动添加数据
  • (/hack/768)
  • [2024-07-31 22:00:17]
  • hack成功,自动添加数据
  • (/hack/765)
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-12 16:15:26]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3392kb
  • [2023-06-12 16:15:23]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define X first
#define Y second
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define SZ(a) ((int)a.size())

int arr[100005];
int cnt[3] = {};

void first() {
    cout << "Zenyk\n";
    exit(0);
}

void second() {
    cout << "Marichka\n";
    exit(0);
}

int main() {
    ios::sync_with_stdio(0), cin.tie(0);

    auto fight = [&]() {
        return cnt[2] & 1;    
    };

    int n, a, b;
    cin >> n >> a >> b;

    auto idx = [&](int m) {
        if (m % (a + b) < a) return 0;
        if (m % (a + b) < b) return 1;
        return 2;
    };

    for (int i = 1; i <= n; ++i) {
        cin >> arr[i];
        ++cnt[idx(arr[i])];
    }

    if (a <= b) {
        if (fight()) first(); 
        else second();
    }
    else {
        for (int i = 1; i <= n; ++i) {
            if (arr[i] >= b) {
                --cnt[idx(arr[i])];
                arr[i] -= b;
                ++cnt[idx(arr[i])];
                if (!fight()) first();
                --cnt[idx(arr[i])];
                arr[i] += b;
                ++cnt[idx(arr[i])];
            }
        }
        second();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3360kb

input:

4 4 7
7 2 14 7

output:

Marichka

result:

ok single line: 'Marichka'

Test #2:

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

input:

20 1 1
6 10 2 4 7 8 8 1 5 5 7 7 4 1 10 9 9 4 8 1

output:

Marichka

result:

ok single line: 'Marichka'

Test #3:

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

input:

20 1 1
414 181 316 53 92 312 622 524 552 324 288 895 708 373 352 167 424 989 976 276

output:

Marichka

result:

ok single line: 'Marichka'

Test #4:

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

input:

20 1 1
2476 3753 129 43 5076 8018 4382 2175 8178 8843 3061 9366 3344 8642 2148 785 8670 2428 2300 2999

output:

Marichka

result:

ok single line: 'Marichka'

Test #5:

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

input:

20 1 1
137810 629048 57380 122292 841453 831316 109917 665931 784954 324075 599876 495466 276505 974952 967899 94960 447567 894845 70023 743552

output:

Zenyk

result:

ok single line: 'Zenyk'

Test #6:

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

input:

20 1 1
603612750 319945652 916047899 984639911 36858338 307217388 346606441 854711869 9443937 55167056 157372379 873443436 183061243 692493631 554311914 5098733 188700177 947666284 993329795 896423950

output:

Zenyk

result:

ok single line: 'Zenyk'

Test #7:

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

input:

20 1 100
10 6 9 7 4 4 8 9 2 10 8 7 9 1 4 7 7 5 9 1

output:

Marichka

result:

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