Submission #19112625


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 == s3 ) 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 0
Code Size 802 Byte
Status WA
Exec Time 57 ms
Memory 7028 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:27:20: warning: suggest parentheses around comparison in operand of ‘^’ [-Wparentheses]
   27 |   if( f1 ^ f2 ^ f3 == 0 && s1 == s2 == s3 ) ans = "Yes";
      |                 ~~~^~~~
./Main.cpp:27:31: warning: suggest parentheses around comparison in operand of ‘==’ [-Wparentheses]
   27 |   if( f1 ^ f2 ^ f3 == 0 && s1 == s2 == s3 ) ans = "Yes";
      |                            ~~~^~~~~
./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 0 / 300
Status
AC × 2
AC × 22
WA × 2
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 6 ms 3420 KB
after_contest_02.txt AC 2 ms 3612 KB
sample_01.txt AC 2 ms 3476 KB
sample_02.txt AC 2 ms 3572 KB
test_01.txt AC 18 ms 3608 KB
test_02.txt AC 18 ms 3548 KB
test_03.txt AC 19 ms 3572 KB
test_04.txt AC 30 ms 3572 KB
test_05.txt WA 39 ms 3504 KB
test_06.txt WA 26 ms 3576 KB
test_07.txt AC 22 ms 3552 KB
test_08.txt AC 16 ms 3396 KB
test_09.txt AC 26 ms 3536 KB
test_10.txt AC 38 ms 3576 KB
test_11.txt AC 26 ms 3448 KB
test_12.txt AC 35 ms 3536 KB
test_13.txt AC 34 ms 3396 KB
test_14.txt AC 28 ms 3476 KB
test_15.txt AC 33 ms 3532 KB
test_16.txt AC 12 ms 3500 KB
test_17.txt AC 9 ms 3528 KB
test_18.txt AC 8 ms 3420 KB
test_19.txt AC 14 ms 3552 KB
test_20.txt AC 57 ms 7028 KB