Submission #19112714
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 | 0 |
Code Size | 820 Byte |
Status | WA |
Exec Time | 54 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 && s2 == s3 && s3 == s1 ) 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 |
|
|
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 | 8 ms | 3400 KB |
after_contest_02.txt | AC | 2 ms | 3392 KB |
sample_01.txt | AC | 2 ms | 3580 KB |
sample_02.txt | AC | 2 ms | 3476 KB |
test_01.txt | AC | 17 ms | 3536 KB |
test_02.txt | AC | 20 ms | 3540 KB |
test_03.txt | AC | 17 ms | 3600 KB |
test_04.txt | AC | 30 ms | 3532 KB |
test_05.txt | AC | 37 ms | 3456 KB |
test_06.txt | AC | 19 ms | 3532 KB |
test_07.txt | AC | 18 ms | 3616 KB |
test_08.txt | AC | 19 ms | 3576 KB |
test_09.txt | AC | 19 ms | 3396 KB |
test_10.txt | WA | 35 ms | 3540 KB |
test_11.txt | WA | 20 ms | 3580 KB |
test_12.txt | AC | 34 ms | 3500 KB |
test_13.txt | AC | 25 ms | 3576 KB |
test_14.txt | AC | 22 ms | 3500 KB |
test_15.txt | AC | 34 ms | 3540 KB |
test_16.txt | AC | 10 ms | 3548 KB |
test_17.txt | AC | 7 ms | 3612 KB |
test_18.txt | AC | 8 ms | 3512 KB |
test_19.txt | AC | 17 ms | 3580 KB |
test_20.txt | AC | 54 ms | 7028 KB |