QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#689795#9223. Data Determinationucup-team902#WA 19ms7496kbC++171.5kb2024-10-30 18:41:052024-10-30 18:41:06

Judging History

你现在查看的是最新测评结果

  • [2024-10-30 18:41:06]
  • 评测
  • 测评结果:WA
  • 用时:19ms
  • 内存:7496kb
  • [2024-10-30 18:41:05]
  • 提交

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{
		for(int i=1;i<=n;i++){
			int x=a[i];
			int y=2*m-a[i];
			int p=lower_bound(a+1,a+n+1,y)-a;
			if(i<p){
				if(p<=n&&a[p]==y){
					int x1=i,x2=n-p+1;
					if(x1>=k/2&&x2>=k/2){
						puts("TAK");return;
					}
				}
			}
		}
		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: 3576kb

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: 19ms
memory: 7496kb

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: 16ms
memory: 6496kb

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
TAK
NIE
TAK
NIE
NIE
NIE
NIE
NIE

result:

wrong answer 2nd lines differ - expected: 'TAK', found: 'NIE'