General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
245130157 Contestant:
jianhe
1927C - 19 C++17 (GCC 7-32) Accepted 139 ms 2948 KB 2024-02-06 18:14:52 2024-02-07 12:41:57
→ Source
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll N=1e6+10;
ll T,n,m,k,ct1,ct2,a,b;
bool p[N],p1[N],p2[N];
bool flag;
int main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>T;
    while(T--){
		cin>>n>>m>>k;
		flag=1;ct1=ct2=0;
		for(int i=1;i<=k;i++) p[i]=p1[i]=p2[i]=0;
		for(int i=1;i<=n;i++) cin>>a,p[a]=1,p1[a]=1;
		for(int i=1;i<=m;i++) cin>>b,p[b]=1,p2[b]=1;
		for(int i=1;i<=k;i++)
			if(!p[i]){flag=0;break;}
		for(int i=1;i<=k;i++)
			if(p1[i]) ct1++;
		for(int i=1;i<=k;i++)
			if(p2[i]) ct2++;
		if(ct1<k/2||ct2<k/2) flag=0;
		if(flag) cout<<"YES\n";
		else cout<<"NO\n";
    }
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details