結果

問題 No.2270 T0空間
ユーザー jinya nakamurajinya nakamura
提出日時 2023-04-14 23:16:17
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,350 bytes
コンパイル時間 2,484 ms
コンパイル使用メモリ 204,144 KB
実行使用メモリ 41,856 KB
最終ジャッジ日時 2024-04-18 20:55:48
合計ジャッジ時間 7,019 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 52 ms
11,392 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 122 ms
18,176 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 478 ms
41,728 KB
testcase_18 WA -
testcase_19 AC 374 ms
41,728 KB
testcase_20 AC 386 ms
41,600 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
// const ll INF = numeric_limits<ll>::max() / 4;
// const int INF = numeric_limits<int>::max() / 4;
// cout << std::fixed << std::setprecision(15);



void MakeXORBasis(vector<int>& A, vector<int>& B){
}

int main() {
	int N, M;
	cin >> N >> M;
	if(N == 1){
		cout << "Yes" << endl;
		return 0;
	}
	vector<string> S(M);
	for(int i = 0; i < M; i++) cin >> S[i];
	int K = (N / 64) + 1;
	vector X(M, vector<ull>(K, 0));
	for(int i = 0; i < M; i++){
		for(int k = 0; k < K; k++){
			for(int b = 0; k * 64 + b < N; b++){
				if(S[i][k * 64 + b] == '1') X[i][k] += (1ULL << b);
			}
		}
	}

	vector<vector<ull> > Y;
	for(int i = 0; i < M; i++){
		vector<ull> a = X[i];
		for(auto it = Y.begin(); it != Y.end(); it++){
			vector<ull> b = *it;
			int f = 0;
			for(int k = 0; k < K; k++){
				if(f == -1){
					a[k] = a[k];
				}else if(f == 1){
					a[k] = a[k] ^ b[k];
				}else{
					if(a[k] < a[k] ^ b[k]){
						a[k] = a[k];
						f = -1;
					}else if(a[k] > a[k] ^ b[k]){
						a[k] = a[k] ^ b[k];
						f = 1;
					}
				}
			}
		}
		bool f = false;
		for(int k = 0; k < K; k++) if(a[k] != 0) f = true;
		if(f) Y.push_back(a);
		if(N <= Y.size()) break;
	}
	if(N <= Y.size()){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}
0