結果
| 問題 |
No.5001 排他的論理和でランニング
|
| ユーザー |
ldsyb
|
| 提出日時 | 2018-03-24 11:06:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,494 ms / 1,500 ms |
| コード長 | 669 bytes |
| コンパイル時間 | 1,412 ms |
| 実行使用メモリ | 7,484 KB |
| スコア | 52,428,749 |
| 最終ジャッジ日時 | 2020-03-12 20:23:16 |
|
ジャッジサーバーID (参考情報) |
judge6 / |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#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];
uniform_int_distribution<> rand(0, n - 1);
for (auto &i : a) {
cin >> i;
}
if (m < n) {
int d = n - m, x = 0;
for (int i = 0; i < m; i++) {
x ^= a[i];
}
while (duration_cast<milliseconds>(system_clock::now() - start).count() < 1485) {
int i = rand(mt) % m, j = rand(mt) % d + m;
int y = x ^ a[i] ^ a[j];
if (x < y) {
x = y;
swap(a[i], a[j]);
}
}
}
for (int i = 0; i < m; i++) {
cout << a[i] << ' ';
}
cout << endl;
return 0;
}
ldsyb