QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#689873#9223. Data Determinationucup-team902#WA 0ms3596kbC++171.9kb2024-10-30 19:00:202024-10-30 19:00:21

Judging History

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

  • [2024-10-30 19:00:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3596kb
  • [2024-10-30 19:00:20]
  • 提交

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];
				if(up.find(y)!=up.end()){
					int t2=up[y];
					if(t1>=k/2&&t2>=k/2){
						puts("TAK");
						return;
					}
				}
			}
			if(x==y&&cnt[x]>1){
				int x=low[a[i]]-1;
				int y=up[a[i]]-1;
				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: 0
Wrong Answer
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:

NIE
NIE
NIE

result:

wrong answer 1st lines differ - expected: 'TAK', found: 'NIE'