QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#689890 | #9223. Data Determination | ucup-team902# | WA | 156ms | 34868kb | C++17 | 1.9kb | 2024-10-30 19:05:30 | 2024-10-30 19:05:32 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define fi first
#define se second
#define bg begin
cs int RLEN=1<<22|1;
char ibuf[RLEN],*ib,*ob;
inline char gc(){
(ib==ob)&&(ob=(ib=ibuf)+fread(ibuf,1,RLEN,stdin));
return (ib==ob)?EOF:*ib++;
}
inline int read(){
char ch=gc();
int res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
inline ll readll(){
char ch=gc();
ll res=0;bool f=1;
while(!isdigit(ch))f^=ch=='-',ch=gc();
while(isdigit(ch))res=(res+(res<<2)<<1)+(ch^48),ch=gc();
return f?res:-res;
}
template<typename tp>inline void chemx(tp &a,tp b){(a<b)?(a=b):0;}
template<typename tp>inline void chemn(tp &a,tp b){(a>b)?(a=b):0;}
cs int N=200005;
int n,k,m;
int a[N];
void solve(){
n=read(),k=read(),m=read();
for(int i=1;i<=n;i++)a[i]=read();
sort(a+1,a+n+1);
if(k&1){
int t=k/2;
for(int i=1;i<=n;i++)if(a[i]==m){
int x1=i-1,x2=n-i;
if(x1>=t&&x2>=t){
puts("TAK");
return;
}
}
puts("NIE");
}
else{
map<int,int>low;
map<int,int>up;
map<int,int>cnt;
for(int i=1;i<=n;i++)if(!low[a[i]]){
low[a[i]]=i;
}
for(int i=n;i;i--)if(!up[a[i]]){
up[a[i]]=n-i+1;
}
for(int i=1;i<=n;i++)cnt[a[i]]++;
for(int i=1;i<=n;i++){
int x=a[i];
int y=2*m-a[i];
if(x<y){
int t1=low[x]+cnt[x]-1;
if(up.find(y)!=up.end()){
int t2=up[y]+cnt[y]-1;
if(t1>=k/2&&t2>=k/2){
puts("TAK");
return;
}
}
}
if(x==y&&cnt[x]>1){
int x=low[a[i]];
int y=up[a[i]];
int t=cnt[a[i]]-2;
int d1=max(k/2-x,0)+max(k/2-y,0);
if(d1<=t){
puts("NIE");
}
}
}
puts("NIE");
}
}
int main(){
#ifdef Stargazer
freopen("1.in","r",stdin);
#endif
int T=read();
while(T--)solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
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: 156ms
memory: 34868kb
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: 55ms
memory: 8656kb
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 NIE NIE NIE TAK NIE TAK NIE NIE NIE NIE NIE
result:
wrong answer 2nd lines differ - expected: 'TAK', found: 'NIE'