/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 11ms 532.0 KiB
#3 Accepted 11ms 532.0 KiB
#4 Accepted 3ms 532.0 KiB
#5 Accepted 20ms 532.0 KiB
#6 Accepted 22ms 2.02 MiB
#7 Accepted 22ms 2.02 MiB

Code

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#define ll long long

using namespace std;

int main(){
	ios :: sync_with_stdio(false);
	cin.tie(0);
	
	int tc;
	cin>>tc;
	while(tc--){
		ll n,m;
		cin>>n>>m;
		vector<ll>v(n),vv(m);
		set<ll>st,st2;
		int cnt0 = 1,cnt = 0,cnt2 = 0, cnt3 = 0 ;
		for(auto &it:v){
			cin>>it;
			if(it == 0) cnt0 = 1;
			else if(it == 1) cnt = 1;
			else if(it == 2) cnt2 = 1;
			else if(it == 3) cnt3 = 1;
		}
		int a,b,c,d;
		for(auto &it:vv){
			cin>>it;
			if(it == 0) a = 1;
			else if(it == 1) b = 1;
			else if(it == 2) c = 1;
			else if(it == 3) d = 1;
			st2.insert(it);
		}
		sort(v.begin(),v.end());
		sort(vv.begin(),vv.end());
		if(cnt0 + cnt + cnt2 + cnt3 == 4){
			if(st2.size() == 9){
				if(vv[0] == 0){
					cout<<"NO\n";
				}
				else{
					cout<<"YES\n";
				}
			}
			else if(st2.size() == 10){
				cout<<"YES\n";
			}
			else{
				cout<<"NO\n";
			}
		}
		else if(a + b + c + d == 4 ){
			if(st.size() == 9){
				if(vv[0] == 0){
					cout<<"NO\n";
				}
				else{
					cout<<"YES\n";
				}
			}
			else if(st.size() == 10){
				cout<<"YES\n";
			}
			else{
				cout<<"NO\n";
			}
		}
		else{
			cout<<"NO\n";
		}
	}
	return 0;
}

Information

Submit By
Type
Submission
Problem
P1153 Is Date Possible?
Contest
Happy New Year 2025
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-02 15:27:19
Judged At
2025-01-02 15:27:19
Judged By
Score
80
Total Time
22ms
Peak Memory
2.02 MiB