結果

問題 No.5008 [Cherry Alpha] Discrete Pendulum with Air Resistance
ユーザー Akijin_007Akijin_007
提出日時 2022-10-15 00:28:09
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 2,749 bytes
コンパイル時間 349 ms
実行使用メモリ 87,760 KB
スコア 915,653,347,627,066
最終ジャッジ日時 2022-10-15 00:30:01
合計ジャッジ時間 110,670 ms
ジャッジサーバーID
(参考情報)
judge12 / judge8
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,984 ms
85,668 KB
testcase_01 AC 1,985 ms
86,340 KB
testcase_02 AC 1,988 ms
87,144 KB
testcase_03 AC 1,984 ms
85,644 KB
testcase_04 AC 1,985 ms
86,584 KB
testcase_05 AC 1,982 ms
85,684 KB
testcase_06 AC 1,985 ms
85,996 KB
testcase_07 AC 1,984 ms
86,268 KB
testcase_08 TLE -
testcase_09 TLE -
testcase_10 TLE -
testcase_11 AC 1,994 ms
86,076 KB
testcase_12 AC 1,985 ms
86,032 KB
testcase_13 AC 1,982 ms
85,748 KB
testcase_14 AC 1,987 ms
87,144 KB
testcase_15 AC 1,983 ms
87,760 KB
testcase_16 AC 1,985 ms
85,476 KB
testcase_17 AC 1,988 ms
86,996 KB
testcase_18 AC 1,994 ms
85,092 KB
testcase_19 AC 1,992 ms
86,284 KB
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 AC 1,998 ms
86,636 KB
testcase_24 AC 1,993 ms
86,044 KB
testcase_25 AC 1,984 ms
85,204 KB
testcase_26 AC 1,983 ms
87,628 KB
testcase_27 AC 1,981 ms
86,120 KB
testcase_28 AC 1,986 ms
85,132 KB
testcase_29 AC 1,983 ms
86,200 KB
testcase_30 AC 1,984 ms
86,424 KB
testcase_31 AC 1,982 ms
85,128 KB
testcase_32 AC 1,981 ms
86,716 KB
testcase_33 AC 1,983 ms
85,708 KB
testcase_34 AC 1,982 ms
86,540 KB
testcase_35 AC 1,985 ms
86,964 KB
testcase_36 AC 1,982 ms
86,008 KB
testcase_37 AC 1,982 ms
86,048 KB
testcase_38 AC 1,984 ms
86,868 KB
testcase_39 AC 1,992 ms
86,064 KB
testcase_40 AC 1,985 ms
85,864 KB
testcase_41 AC 1,995 ms
85,552 KB
testcase_42 AC 1,985 ms
87,632 KB
testcase_43 TLE -
testcase_44 TLE -
testcase_45 TLE -
testcase_46 AC 1,999 ms
86,472 KB
testcase_47 TLE -
testcase_48 AC 1,986 ms
85,704 KB
testcase_49 AC 1,984 ms
85,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(t, B, M, E):
    u, v = divmod(B-M, E)
    a = time0(u, B, E)
    # print(a)
    if t < a:
        min1 = 0
        max1 = u+1
        while max1 - min1 > 1:
            h = (max1 + min1) // 2
            ha = time0(h-1, B, E)
            if ha > t:
                max1 = h
            else:
                min1 = h
        hmin = time0(min1-1, B, E)
        hmax = time0(min1, B, E)
        # print(min1, hmin, hmax)
        px = min(abs(t - hmin), abs(hmax - t))
        if min1 % 2 == 0:
            return px
        else:
            return -px
    else:
        p, q = divmod(t - a, 2*M)
        px = min(abs(t - (a + p*2*M)), abs(t - (a + (p+1)*2*M)))
        if (p + u + 1) % 2 == 0:
            return px
        else:
            return -px

def time0(times, B, E):
    return (times + 1) * (2 * B - times * E)

def score(B, M, E):
    Sconf = 0
    for u in T:
        a = 0
        x = [0] * N
        for i in range(N):
            x[i] = f(u, B[i], M[i], E[i])
        for i in range(N-1):
            for j in range(i+1, N):
                a += abs(x[i] - x[j]) / (B[i] + B[j])
        # print(x, a)
        Sconf += round(2 * 10 ** 7 * a / (N * (N - 1)))

    Sconf = round(Sconf / K)

    Scoop = 0
    for u in U:
        for i in range(N):
            x[i] = f(u, B[i], M[i], E[i])
        Scoop += 10 ** 7 / (((max(x) - min(x)) / 20 + 1) ** 0.5)

    Scoop = round(Scoop / K)
    # print(Sconf, Scoop)

    return Sconf * Scoop

def stdinput():
    N, K = map(int, input().split())
    T = list(map(int, input().split()))
    U = list(map(int, input().split()))
    return N, K, T, U

def randinput():
    N = 50
    K = 50
    delta = 200
    G = [0] * (2 * K + 1)
    i = random.randint(0, 1)
    F = [0] * (2 * K)
    while True:
        for i in range(2 * K):
            F[i] = random.random()
            if F[i] == 0:
                F[i] = random.random()
        for i in range(2*K):
            G[i+1] = round(G[i] + delta / F[i])
        if G[-1] <= 10 ** 9:
            break
    if i % 2 == 0:
        T = G[1::2]
        U = G[2::2]
    else:
        T = G[2::2]
        U = G[1::2]
    return N, K, T, U

import random
import time

# N, K, T, U = randinput()
N, K, T, U = stdinput()

ut = time.time()

NB = [0] * N
NM = [0] * N
NE = [0] * N

maxscore = 0

m = 3
# i = 0

while time.time() - ut < 1.9:
    # i += 1
    for i in range(N):
        NB[i] = random.randint(1, m)
        NM[i] = random.randint(1, NB[i])
        NE[i] = random.randint(1, m)
    sc = score(NB, NM, NE)
    if maxscore < sc:
        B = list(NB)
        M = list(NM)
        E = list(NE)
        maxscore = sc

# for i in range(N):
#     print(f(m, B[i], M[i], E[i]))
for i in range(N):
    print(B[i], M[i], E[i])
# print(i)



0