QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#549604 | #9223. Data Determination | snow | WA | 22ms | 5156kb | C++23 | 1.6kb | 2024-09-06 18:30:06 | 2024-09-06 18:30:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main(void)
{
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll t;
cin>>t;
while(t--)
{
ll n,k,m;
cin>>n>>k>>m;
ll a[n+1]={0};
for(ll i=1;i<=n;i++)
{
cin>>a[i];
}
sort(a+1,a+n+1);
if(k%2)
{
ll f=0;
for(ll i=1;i<=n;i++)
{
ll d=(k-1)/2;
if(a[i]==m&&i-1>=d&&n-i>=d)
{
f=1;
break;
}
}
if(f)
cout<<"TAK\n";
else
cout<<"NIE\n";
}
else if(a[n]<m)
cout<<"NIE\n";
else
{
ll f=0;
ll l=lower_bound(a+1,a+n+1,m)-a;
ll r=l+1;
//cout<<l<<' '<<r<<'\n';
ll d=k/2-1;
while(l>=1&&r<=n)
{
if(l-1<d||n-r<d)
break;
if(a[l]+a[r]==m*2)
{
if(l-1>=d&&n-r>=d)
{
f=1;
break;
}
}
else if(a[l]+a[r]>m*2)
{
l--;
}
else
r++;
}
if(f)
cout<<"TAK\n";
else
cout<<"NIE\n";
}
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3660kb
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: 22ms
memory: 5156kb
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: 0
Accepted
time: 17ms
memory: 3812kb
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 NIE NIE NIE NIE NIE
result:
ok 10 lines
Test #4:
score: -100
Wrong Answer
time: 20ms
memory: 3868kb
input:
10 20000 6 569116309 533654855 569116308 512534907 569116310 500238175 562175605 569116308 569116310 489499020 543748669 569116309 526641247 511510060 504576222 569116309 569116310 569116308 569116310 569116309 569116308 569116309 569116310 569116308 569116310 569116309 569116308 465300463 569116308...
output:
TAK TAK NIE NIE NIE NIE NIE NIE NIE TAK
result:
wrong answer 8th lines differ - expected: 'TAK', found: 'NIE'