Submission #19113013


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;

int main()
{
	int N;
	cin >> N;
	map<int, int> mp;
	for( int i = 0; i < N; i++ ) {
		int a;
		cin >> a;
		mp[a]++;
	}

	string ans = "No";
	if( mp.size() == 1 && mp.begin()->first == 0 ) ans = "Yes";
	else if( mp.size() == 3 ) {
		auto it = mp.begin();
		int f1 = it->first;
		int s1 = it->second;
		it++;
		int f2 = it->first;
		int s2 = it->second;
		it++;
		int f3 = it->first;
		int s3 = it->second;
		if( (f1 ^ f2 ^ f3) == 0 && s1 == s2 && s2 == s3 && s3 == s1 ) ans = "Yes";
	}
	else if( mp.size() == 2 ) {
		auto it = mp.begin();
		int f1 = it->first;
		int s1 = it->second;
		it++;
		int f2 = it->first;
		int s2 = it->second;
		if( s1 * 2 == s2 && f1 == 0 || s1 == s2 * 2 && f2 == 0 ) ans = "Yes";
	}

	cout << ans << endl;
}

Submission Info

Submission Time
Task A - XOR Circle
User forest3
Language C++ (GCC 9.2.1)
Score 300
Code Size 822 Byte
Status AC
Exec Time 57 ms
Memory 7156 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:36:20: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
   36 |   if( s1 * 2 == s2 && f1 == 0 || s1 == s2 * 2 && f2 == 0 ) ans = "Yes";
      |       ~~~~~~~~~~~~~^~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 24
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All after_contest_01.txt, after_contest_02.txt, sample_01.txt, sample_02.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt
Case Name Status Exec Time Memory
after_contest_01.txt AC 9 ms 3500 KB
after_contest_02.txt AC 2 ms 3388 KB
sample_01.txt AC 2 ms 3456 KB
sample_02.txt AC 2 ms 3524 KB
test_01.txt AC 27 ms 3440 KB
test_02.txt AC 17 ms 3524 KB
test_03.txt AC 29 ms 3580 KB
test_04.txt AC 29 ms 3384 KB
test_05.txt AC 41 ms 3452 KB
test_06.txt AC 21 ms 3528 KB
test_07.txt AC 23 ms 3564 KB
test_08.txt AC 15 ms 3600 KB
test_09.txt AC 22 ms 3604 KB
test_10.txt AC 37 ms 3452 KB
test_11.txt AC 21 ms 3500 KB
test_12.txt AC 37 ms 3452 KB
test_13.txt AC 26 ms 3528 KB
test_14.txt AC 26 ms 3376 KB
test_15.txt AC 36 ms 3456 KB
test_16.txt AC 8 ms 3576 KB
test_17.txt AC 8 ms 3388 KB
test_18.txt AC 9 ms 3564 KB
test_19.txt AC 14 ms 3500 KB
test_20.txt AC 57 ms 7156 KB