結果

問題 No.2442 線形写像
ユーザー achapiachapi
提出日時 2023-08-25 21:58:44
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 883 bytes
コンパイル時間 2,092 ms
コンパイル使用メモリ 208,252 KB
実行使用メモリ 7,028 KB
最終ジャッジ日時 2023-08-25 21:58:48
合計ジャッジ時間 3,721 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 WA -
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 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,376 KB
testcase_14 AC 56 ms
5,036 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 105 ms
6,640 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 (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 = false;
		for (int j = 0; j < N; j++){
			set<vector<long long>> s;
			vector<long long> C;
			for (int k = 0; k < (1 << N); k++){
				C.push_back(B[k]);
				if ((int) C.size() == (1 << j)){
					s.insert(C);
					C.clear();
				}
			}
			if ((int) s.size() == 1){
				ok2 = true;
				break;
			}
		}
		if (ok2){
			continue;
		}
		ok = false;
		break;
	}
	if (ok){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}
0