結果

問題 No.2442 線形写像
ユーザー achapi
提出日時 2023-08-25 21:48:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 829 bytes
コンパイル時間 2,129 ms
コンパイル使用メモリ 195,028 KB
最終ジャッジ日時 2025-02-16 13:55:56
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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 (N == 0){
		if (A[0] == 0){
			cout << "Yes" << endl;
			return 0;
		} else {
			cout << "No" << endl;
			return 0;
		}
	}
	bool ok = true;
	for (int i = 0; i < 64; i++){
		vector<long long> B(1 << N);
		for (int j = 0; j < (1 << N); j++){
			B[j] = A[j] & (1LL << i);
		}
		bool ok2 = true;
		for (int j = 0; j < (1 << N); j++){
			if (B[j] != B[(1 << N) - 1 - j]){
				ok2 = false;
			}
		}
		if (ok2){
			continue;
		}
		ok2 = true;
		for (int j = 0; j < (1 << N) / 2; j++){
			if (B[j] != B[(1 << N) / 2 + j]){
				ok2 = false;
			}
		}
		if (ok2){
			continue;
		}
		ok = false;
	}
	if (ok){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}
0