結果
| 問題 |
No.5001 排他的論理和でランニング
|
| ユーザー |
merom686
|
| 提出日時 | 2018-03-16 22:35:39 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 624 ms / 1,500 ms |
| コード長 | 846 bytes |
| コンパイル時間 | 599 ms |
| 実行使用メモリ | 6,148 KB |
| スコア | 52,428,750 |
| 最終ジャッジ日時 | 2020-03-12 19:24:35 |
|
ジャッジサーバーID (参考情報) |
judge6 / |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
int x = 0;
for (int i = 0; i < m; i++) {
x ^= a[i];
}
int l = n - m;
if (l > 0) {
mt19937_64 rnd;
for (int k = 0; k < 1 << 24; k++) {
int i = rnd() % m;
int j = rnd() % l + m;
int y = x ^ a[i] ^ a[j];
if (y > x) {
x = y;
swap(a[i], a[j]);
}
}
}
for (int i = 0; i < m; i++) {
cout << a[i] << " \n"[i == m - 1];
}
return 0;
}
merom686