結果

問題 No.5001 排他的論理和でランニング
ユーザー ldsyb
提出日時 2018-03-23 16:48:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,490 ms / 1,500 ms
コード長 670 bytes
コンパイル時間 1,446 ms
実行使用メモリ 7,424 KB
スコア 52,393,945
最終ジャッジ日時 2020-03-12 20:21:55
ジャッジサーバーID
(参考情報)
judge8 /
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	auto start = system_clock::now();
	random_device rnd;
	mt19937 mt(rnd());
	int n, m;
	cin >> n >> m;
	int a[n];
	for (auto &i : a) {
		cin >> i;
	}
	pair<int, vector<int>> ans(0, vector<int>());
	while (duration_cast<milliseconds>(system_clock::now() - start).count() < 1480) {
		shuffle(a, a + n, mt);
		int score = 0;
		for (int i = 0; i < m; i++) {
			score ^= a[i];
		}
		if (ans.first < score) {
			vector<int> v(m);
			for (int i = 0; i < m; i++) {
				v[i] = a[i];
			}
			ans = {score, v};
		}
	}
	for (auto &i : ans.second) {
		cout << i << ' ';
	}
	cout << endl;
	return 0;
}
0