Submission #24537425
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
int n, x[2005], y[2005];
set<int> ans;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", x + i);
for (int i = 0; i < n; i++)
scanf("%d", y + i);
for (int i = 0; i < n; i++) {
int tmp = x[0] ^ y[i];
multiset<int> s(y, y + n);
for (int j = 0; j < n; j++) {
auto it = s.find(tmp ^ x[j]);
if (it == s.end()) {
tmp = -1;
break;
} else
s.erase(it);
}
if (tmp != -1)
ans.insert(tmp);
}
printf("%d\n", (int)ans.size());
for (int i : ans)
printf("%d\n", i);
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - XOR Matching 2 |
| User | nhho |
| Language | C++ (GCC 9.2.1) |
| Score | 400 |
| Code Size | 596 Byte |
| Status | AC |
| Exec Time | 475 ms |
| Memory | 3892 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:9:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
9 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
./Main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
11 | scanf("%d", x + i);
| ~~~~~^~~~~~~~~~~~~
./Main.cpp:13:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
13 | scanf("%d", y + i);
| ~~~~~^~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | hand2_01.txt, hand2_02.txt, hand2_03.txt, hand2_04.txt, hand2_05.txt, hand2_06.txt, hand2_07.txt, hand2_08.txt, hand2_09.txt, hand2_10.txt, hand3_01.txt, hand3_02.txt, hand3_03.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| hand2_01.txt | AC | 473 ms | 3792 KiB |
| hand2_02.txt | AC | 470 ms | 3792 KiB |
| hand2_03.txt | AC | 472 ms | 3844 KiB |
| hand2_04.txt | AC | 468 ms | 3884 KiB |
| hand2_05.txt | AC | 464 ms | 3788 KiB |
| hand2_06.txt | AC | 35 ms | 3756 KiB |
| hand2_07.txt | AC | 67 ms | 3732 KiB |
| hand2_08.txt | AC | 101 ms | 3668 KiB |
| hand2_09.txt | AC | 45 ms | 3644 KiB |
| hand2_10.txt | AC | 40 ms | 3664 KiB |
| hand3_01.txt | AC | 10 ms | 3704 KiB |
| hand3_02.txt | AC | 30 ms | 3764 KiB |
| hand3_03.txt | AC | 68 ms | 3796 KiB |
| hand_01.txt | AC | 2 ms | 3708 KiB |
| hand_02.txt | AC | 3 ms | 3796 KiB |
| hand_03.txt | AC | 3 ms | 3700 KiB |
| hand_04.txt | AC | 19 ms | 3776 KiB |
| hand_05.txt | AC | 202 ms | 3844 KiB |
| random_01.txt | AC | 430 ms | 3840 KiB |
| random_02.txt | AC | 453 ms | 3888 KiB |
| random_03.txt | AC | 474 ms | 3708 KiB |
| random_04.txt | AC | 464 ms | 3824 KiB |
| random_05.txt | AC | 475 ms | 3804 KiB |
| random_06.txt | AC | 449 ms | 3768 KiB |
| random_07.txt | AC | 413 ms | 3732 KiB |
| random_08.txt | AC | 341 ms | 3736 KiB |
| random_09.txt | AC | 203 ms | 3848 KiB |
| random_10.txt | AC | 46 ms | 3780 KiB |
| random_11.txt | AC | 403 ms | 3780 KiB |
| random_12.txt | AC | 469 ms | 3844 KiB |
| random_13.txt | AC | 474 ms | 3704 KiB |
| random_14.txt | AC | 468 ms | 3732 KiB |
| random_15.txt | AC | 473 ms | 3824 KiB |
| random_16.txt | AC | 453 ms | 3848 KiB |
| random_17.txt | AC | 410 ms | 3892 KiB |
| random_18.txt | AC | 336 ms | 3860 KiB |
| random_19.txt | AC | 201 ms | 3720 KiB |
| random_20.txt | AC | 54 ms | 3832 KiB |
| sample_01.txt | AC | 3 ms | 3704 KiB |
| sample_02.txt | AC | 2 ms | 3688 KiB |
| sample_03.txt | AC | 2 ms | 3696 KiB |