結果

問題 No.699 ペアでチームを作ろう2
ユーザー GrayCoderGrayCoder
提出日時 2019-09-28 05:04:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 262 ms / 1,000 ms
コード長 656 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 15,388 KB
最終ジャッジ日時 2023-10-26 02:51:22
合計ジャッジ時間 3,859 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,000 KB
testcase_01 AC 28 ms
10,000 KB
testcase_02 AC 30 ms
10,020 KB
testcase_03 AC 29 ms
10,000 KB
testcase_04 AC 45 ms
10,408 KB
testcase_05 AC 222 ms
11,152 KB
testcase_06 AC 224 ms
11,152 KB
testcase_07 AC 249 ms
15,388 KB
testcase_08 AC 260 ms
15,388 KB
testcase_09 AC 259 ms
15,388 KB
testcase_10 AC 260 ms
15,388 KB
testcase_11 AC 261 ms
15,388 KB
testcase_12 AC 260 ms
15,388 KB
testcase_13 AC 262 ms
15,388 KB
testcase_14 AC 259 ms
15,388 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import xor
from collections import deque
from functools import reduce
from sys import stdin

def pair(lst):
    def func(a, b):
        n = len(a)
        if n == 2:
            ret.append(reduce(xor, b + [a[0] + a[1]]))
            return
        a0 = a.popleft()
        for _ in [0] * (n - 1):
            ai = a.popleft()
            arg2 = b + [a0 + ai]
            func(a.copy(), arg2)
            a.append(ai)
    lst = deque(lst)
    ret = []
    func(lst, [])
    return ret

def main():
    input = lambda: stdin.readline()
    N = int(input())
    A = list(map(int, input().split()))

    ans = max(pair(A))
    print(ans)

main()
0