QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#632059 | #9226. Game of Geniuses | Cu_OH_2 | WA | 0ms | 3552kb | C++20 | 1.0kb | 2024-10-12 11:47:15 | 2024-10-12 11:47:16 |
Judging History
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