結果
| 問題 |
No.5001 排他的論理和でランニング
|
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2018-03-18 21:33:52 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 727 bytes |
| コンパイル時間 | 1,837 ms |
| 実行使用メモリ | 275,212 KB |
| スコア | 0 |
| 最終ジャッジ日時 | 2020-03-12 20:20:08 |
|
ジャッジサーバーID (参考情報) |
judge10 / |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 49 |
ソースコード
#!/usr/bin/env pypy3
import functools
import itertools
import operator
import random
NUM_MAX_TRIAL = 10 ** 5
def fold_xor(iterable):
return functools.reduce(operator.xor, iterable)
def in_place_solve(m, xs, num_max_trial=NUM_MAX_TRIAL):
random.shuffle(xs)
max_score = 0
res = None
for i, ys in enumerate(itertools.combinations(xs, m)):
if i >= num_max_trial:
break
score = fold_xor(ys)
if score > max_score:
max_score = score
res = ys
return res
def main():
_, m = (int(x) for x in input().split())
xs = [int(x) for x in input().split()]
res = in_place_solve(m, xs)
print(*res)
if __name__ == '__main__':
main()
はむ吉🐹