Contest Duration: ~ (local time) (160 minutes) Back to Home

Submission #4608286

Source Code Expand

Copy
```#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#define MOD (1000000007l)

using namespace std;

long count_bit(long v) {
if (v == 0) return 0;
return count_bit(v >> 1) + (v & 1);
}

void solve(long from, long to, long N, long mask_position) {
if (count_bit(mask_position) == N - 1) {
cout << " " << to;
return;
}
long i = 0;
for (; i < N; i++) {
long now = 1l << i;
if ((mask_position & now) == 0 and (from & now) != (to & now)) {
break;
}
}
long j = 0;
for (; j < N; j++) {
long now = 1l << j;
if ((mask_position & now) == 0) {
break;
}
}
long via = from ^ (1l << j);
long via_2 = via ^ (1l << i);
cout << " " << via_2;
}

int main(void) {
long N, A, B;
cin >> N >> A >> B;

if (count_bit(A) % 2 == count_bit(B) % 2) {
cout << "NO" << endl;
return 0;
}

cout << "YES" << endl;
cout << A;
solve(A, B, N, 0);
cout << endl;

return 0;
}
```

#### Submission Info

Submission Time 2019-03-17 05:59:48+0900 C - Differ by 1 Bit set0gut1 C++14 (GCC 5.4.1) 0 1151 Byte RE 302 ms 262400 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample-01.txt, sample-02.txt
All 0 / 800 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt, 01-30.txt, 01-31.txt, 01-32.txt, 01-33.txt, 01-34.txt, 01-35.txt, 01-36.txt, 01-37.txt, 01-38.txt, 01-39.txt, 01-40.txt, 01-41.txt, 01-42.txt, 01-43.txt, 01-44.txt, 01-45.txt, 01-46.txt, 01-47.txt, 01-48.txt, 01-49.txt, sample-01.txt, sample-02.txt
Case Name Status Exec Time Memory
01-01.txt 1 ms 256 KB
01-02.txt 247 ms 262400 KB
01-03.txt 1 ms 256 KB
01-04.txt 1 ms 256 KB
01-05.txt 1 ms 256 KB
01-06.txt 246 ms 262400 KB
01-07.txt 1 ms 256 KB
01-08.txt 278 ms 262400 KB
01-09.txt 1 ms 256 KB
01-10.txt 286 ms 262400 KB
01-11.txt 1 ms 256 KB
01-12.txt 244 ms 262400 KB
01-13.txt 1 ms 256 KB
01-14.txt 286 ms 262400 KB
01-15.txt 1 ms 256 KB
01-16.txt 269 ms 262400 KB
01-17.txt 1 ms 256 KB
01-18.txt 244 ms 262400 KB
01-19.txt 1 ms 256 KB
01-20.txt 300 ms 262400 KB
01-21.txt 1 ms 256 KB
01-22.txt 245 ms 262400 KB
01-23.txt 1 ms 256 KB
01-24.txt 262 ms 262400 KB
01-25.txt 1 ms 256 KB
01-26.txt 300 ms 262400 KB
01-27.txt 1 ms 256 KB
01-28.txt 302 ms 262400 KB
01-29.txt 1 ms 256 KB
01-30.txt 243 ms 262400 KB
01-31.txt 1 ms 256 KB
01-32.txt 244 ms 262400 KB
01-33.txt 244 ms 262400 KB
01-34.txt 291 ms 262400 KB
01-35.txt 260 ms 262400 KB
01-36.txt 300 ms 262400 KB
01-37.txt 244 ms 262400 KB
01-38.txt 302 ms 262400 KB
01-39.txt 291 ms 262400 KB
01-40.txt 262 ms 262400 KB
01-41.txt 292 ms 262400 KB
01-42.txt 245 ms 262400 KB
01-43.txt 245 ms 262400 KB
01-44.txt 292 ms 262400 KB
01-45.txt 271 ms 262400 KB
01-46.txt 244 ms 262400 KB
01-47.txt 245 ms 262400 KB
01-48.txt 249 ms 262400 KB
01-49.txt 243 ms 262400 KB
sample-01.txt 1 ms 256 KB
sample-02.txt 1 ms 256 KB