QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#581668 | #9223. Data Determination | ricofx# | WA | 95ms | 17900kb | C++17 | 1.7kb | 2024-09-22 13:50:12 | 2024-09-22 13:50:12 |
Judging History
answer
// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define int long long
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 998244353;
const int N = 2e5 + 5;
int n, k, m;
int a[N];
void MAIN() {
cin >> n >> k >> m;
map<int, int> mp;
for (int i = 1; i <= n; ++i) cin >> a[i];
sort(a + 1, a + 1 + n);
for (int i = 1; i <= n; ++i)
if (!mp.count(a[i])) mp[a[i]] = i;
if (k & 1) {
k /= 2;
for (int i = 1; i <= n; ++i)
if (a[i] == m && i > k && (n - i) >= k)
return cout << "TAK" << endl, void();
cout << "NIE" << endl;
} else {
k /= 2, --k;
for (int i = k + 1; i < n && a[i] <= m; ++i) {
int nx = (m * 2) - a[i];
if (mp.count(nx)) {
int pos = mp[nx];
pos = max(pos, i + 1);
if (n - pos >= k)
return cout << "TAK" << endl, void();
}
}
cout << "NIE" << endl;
}
}
signed main() {
#ifdef LOCAL
auto start = chrono::steady_clock::now();
freopen("miku.in", "r", stdin);
freopen("miku.out", "w", stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);
int T = 1;
cin >> T;
while (T--) MAIN();
#ifdef LOCAL
auto end = chrono::steady_clock::now();
cout << "\nqwq: " << chrono::duration_cast<chrono::milliseconds>(end - start).count() << "ms\n";
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3556kb
input:
3 6 4 42 41 43 41 57 41 42 4 2 4 1 2 5 8 7 5 57 101 2 42 5 57 7 13
output:
TAK NIE NIE
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 95ms
memory: 17900kb
input:
1 200000 2 482043846 410684388 380438852 309193412 468460689 586281084 680820569 266819813 639025900 488292166 503516930 532292185 618277661 728546481 628339224 673945619 471325257 372807753 325778059 372151033 548358519 276494019 336701079 320784795 377493322 385262271 621712987 349634764 668994576...
output:
NIE
result:
ok single line: 'NIE'
Test #3:
score: -100
Wrong Answer
time: 39ms
memory: 5028kb
input:
10 20000 3530 502140211 367996343 553577602 581694419 435810361 532394401 431613294 485360190 608191058 506969937 531905607 429252296 360241499 519031654 250454430 478548102 753825992 450326073 603766643 566036856 511634983 416622101 753825992 753825992 380511285 390746506 436237616 342529443 878920...
output:
NIE TAK TAK NIE TAK TAK NIE NIE NIE NIE
result:
wrong answer 6th lines differ - expected: 'NIE', found: 'TAK'