QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#632059#9226. Game of GeniusesCu_OH_2WA 0ms3552kbC++201.0kb2024-10-12 11:47:152024-10-12 11:47:16

Judging History

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

  • [2024-10-12 11:47:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3552kb
  • [2024-10-12 11:47:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

void solve()
{
    int n, k, m;
    cin >> n >> k >> m;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    sort(a.begin(), a.end());
    if (k % 2)
    {
        for (int i = 0; i < n; ++i)
        {
            if (a[i] == m && i >= k / 2 && n - 1 - i >= k / 2)
            {
                cout << "TAK\n";
                return;
            }
        }
        cout << "NIE\n";
    }
    else
    {
        for (int i = 0; i < n && a[i] <= m; ++i)
        {
            int p = lower_bound(a.begin() + i + 1, a.end(), m * 2 - a[i]) - a.begin();
            if (p == n || a[p] != m * 2 - a[i]) continue;
            if (i >= k / 2 - 1 && n - 1 - p >= k / 2 - 1)
            {
                cout << "TAK\n";
                return;
            }
        }
        cout << "NIE\n";
    }
    return;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    cin >> T;
    while (T--) solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3552kb

input:

3
1 4 9
8 4 2
7 5 7

output:

NIE
NIE
NIE

result:

wrong output format Expected integer, but "NIE" found