結果

問題 No.505 カードの数式2
ユーザー mkawa2mkawa2
提出日時 2020-01-03 12:58:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 1,172 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 487,792 KB
最終ジャッジ日時 2024-05-02 07:13:11
合計ジャッジ時間 22,276 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 538 ms
49,520 KB
testcase_01 AC 536 ms
44,144 KB
testcase_02 AC 545 ms
44,800 KB
testcase_03 AC 526 ms
44,148 KB
testcase_04 AC 526 ms
44,028 KB
testcase_05 AC 538 ms
44,032 KB
testcase_06 AC 536 ms
44,160 KB
testcase_07 AC 532 ms
44,160 KB
testcase_08 AC 533 ms
44,032 KB
testcase_09 AC 532 ms
44,156 KB
testcase_10 AC 540 ms
44,152 KB
testcase_11 AC 532 ms
44,156 KB
testcase_12 AC 539 ms
44,156 KB
testcase_13 AC 528 ms
44,160 KB
testcase_14 AC 528 ms
44,276 KB
testcase_15 AC 531 ms
44,188 KB
testcase_16 AC 533 ms
44,028 KB
testcase_17 AC 537 ms
44,024 KB
testcase_18 AC 537 ms
44,036 KB
testcase_19 AC 546 ms
44,032 KB
testcase_20 AC 538 ms
43,908 KB
testcase_21 AC 545 ms
44,152 KB
testcase_22 AC 1,091 ms
132,956 KB
testcase_23 AC 617 ms
53,672 KB
testcase_24 AC 528 ms
44,024 KB
testcase_25 AC 537 ms
44,152 KB
testcase_26 AC 1,497 ms
154,160 KB
testcase_27 AC 1,539 ms
154,748 KB
testcase_28 TLE -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import *
from bisect import *
# from math import *
from collections import *
from heapq import *
from random import *
from decimal import *
import numpy as np
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
dij = [(0, 1), (1, 0), (0, -1), (-1, 0)]

def main():
    def div(a,b):
        res=abs(a)//abs(b)
        coff=(a*b>0)*2-1
        return coff*res
    n=II()
    aa=LI()
    now=set()
    now.add(aa[0])
    for a in aa[1:]:
        nxt=set()
        for s in now:
            nxt.add(s+a)
            nxt.add(s-a)
            nxt.add(s*a)
            if a!=0:nxt.add(div(s,a))
        now=nxt
    print(max(now))

main()
0