結果

問題 No.2442 線形写像
ユーザー achapiachapi
提出日時 2023-08-25 22:13:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 849 bytes
コンパイル時間 1,766 ms
コンパイル使用メモリ 203,400 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2023-08-25 22:13:47
合計ジャッジ時間 3,119 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 27 ms
4,584 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 103 ms
6,220 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int N;
	cin >> N;
	vector<long long> A(1 << N);
	for (int i = 0; i < (1 << N); i++) {
		cin >> A[i];
	}
	if (A[0] != 0){
		cout << "No" << endl;
		return 0;
	}
	bool ok = true;
	for (int i = 0; i < 64; i++){
		vector<long long> B((1 << N) / 2), C((1 << N) / 2);
		for (int j = 0; j < (1 << N) / 2; j++){
			B[j] = A[j] & (1LL << i);
		}
		for (int j = 0; j < (1 << N) / 2; j++){
			C[j] = A[(1 << N) / 2 + j] & (1LL << i);
		}
		auto B2 = B;
		auto C2 = C;
		reverse(B2.begin(), B2.end());
		reverse(C2.begin(), C2.end());
		if (B == B2 and C == C2){
			continue;
		}
		for (int j = 0; j < (1 << N) / 2; j++){
			B2[j] ^= 1;
			C2[j] ^= 1;
		}
		if (B == B2 and C == C2){
			continue;
		}
		ok = false;
		break;
	}
	if (ok){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}
0