QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#549492 | #9223. Data Determination | linxin114 | WA | 0ms | 3540kb | C++14 | 1.7kb | 2024-09-06 16:25:48 | 2024-09-06 16:25:49 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define sc scanf
#define dl double
#define pr printf
long long gcd(long long a, long long b)
{
if (a < b)
swap(a, b); // 如果b大的话就交换值 让b%a
if (b == 0) // 除到最后 如果返回的值是1 说明两个数互质
return a;
else
return gcd(a % b, b);
}
long long mod_inv(long long x, long long mod)
{
long long result = 1;
long long power = mod - 2;
while (power > 0)
{
if (power % 2 == 1)
{
result = (result * x) % mod;
}
x = (x * x) % mod;
power /= 2;
}
return result;
}
ll a[200005];
int main()
{
ll t;
cin >> t;
while(t--){
ll n, k, m;
cin >> n >> k >> m;
ll x=0;
for (ll i = 1; i <= n;i++){
cin>>a[i];
}
sort(a+1, a + n+1);
ll flag = 0;
if(k%2==1){
for (ll i = k / 2 + 1; i <= n - k / 2 - 1;i++){
if(a[i]==m){
flag = 1;
}
}
}
else{
ll x=0;
for (ll i = k / 2; i <= n - k / 2; i++)
{
if(a[i+1+x]==m){
x++;
}
if(i+1+x>=n-k/2+1){
break;
}
if (a[i]+a[i+1+x] == m*2)
{
flag = 1;
}
if(x==2){
flag=1;
}
}
}
if(flag==1){
cout << "TAK" << endl;
}
else{
cout << "NIE" << endl;
}
}
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3540kb
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:
NIE NIE NIE
result:
wrong answer 1st lines differ - expected: 'TAK', found: 'NIE'