結果
| 問題 |
No.5001 排他的論理和でランニング
|
| ユーザー |
はむ吉🐹
|
| 提出日時 | 2018-03-19 20:24:49 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 451 ms / 1,500 ms |
| コード長 | 727 bytes |
| コンパイル時間 | 263 ms |
| 実行使用メモリ | 119,884 KB |
| スコア | 48,243,174 |
| 最終ジャッジ日時 | 2020-03-12 20:20:34 |
|
ジャッジサーバーID (参考情報) |
judge10 / |
| 純コード判定しない問題か言語 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 50 |
ソースコード
#!/usr/bin/env pypy3
import functools
import itertools
import operator
import random
NUM_MAX_TRIAL = 10 ** 1
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()
はむ吉🐹