結果

問題 No.5008 [Cherry Alpha] Discrete Pendulum with Air Resistance
ユーザー Akijin_007Akijin_007
提出日時 2022-10-15 00:41:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,890 ms / 2,000 ms
コード長 2,749 bytes
コンパイル時間 227 ms
実行使用メモリ 87,008 KB
スコア 1,024,752,303,584,741
最終ジャッジ日時 2022-10-15 00:43:09
合計ジャッジ時間 104,467 ms
ジャッジサーバーID
(参考情報)
judge8 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,885 ms
86,496 KB
testcase_01 AC 1,885 ms
85,548 KB
testcase_02 AC 1,884 ms
86,240 KB
testcase_03 AC 1,884 ms
85,628 KB
testcase_04 AC 1,887 ms
85,476 KB
testcase_05 AC 1,884 ms
85,968 KB
testcase_06 AC 1,887 ms
86,356 KB
testcase_07 AC 1,887 ms
85,712 KB
testcase_08 AC 1,886 ms
86,156 KB
testcase_09 AC 1,883 ms
85,756 KB
testcase_10 AC 1,885 ms
85,740 KB
testcase_11 AC 1,886 ms
86,672 KB
testcase_12 AC 1,885 ms
85,988 KB
testcase_13 AC 1,886 ms
86,124 KB
testcase_14 AC 1,887 ms
86,652 KB
testcase_15 AC 1,884 ms
86,012 KB
testcase_16 AC 1,884 ms
85,968 KB
testcase_17 AC 1,884 ms
85,372 KB
testcase_18 AC 1,888 ms
85,664 KB
testcase_19 AC 1,884 ms
87,008 KB
testcase_20 AC 1,886 ms
86,520 KB
testcase_21 AC 1,886 ms
85,676 KB
testcase_22 AC 1,885 ms
85,400 KB
testcase_23 AC 1,885 ms
86,628 KB
testcase_24 AC 1,886 ms
86,168 KB
testcase_25 AC 1,890 ms
85,488 KB
testcase_26 AC 1,884 ms
86,532 KB
testcase_27 AC 1,885 ms
86,096 KB
testcase_28 AC 1,887 ms
85,528 KB
testcase_29 AC 1,887 ms
85,964 KB
testcase_30 AC 1,884 ms
86,292 KB
testcase_31 AC 1,885 ms
86,108 KB
testcase_32 AC 1,887 ms
86,352 KB
testcase_33 AC 1,890 ms
86,028 KB
testcase_34 AC 1,887 ms
86,080 KB
testcase_35 AC 1,887 ms
85,528 KB
testcase_36 AC 1,889 ms
85,472 KB
testcase_37 AC 1,890 ms
86,044 KB
testcase_38 AC 1,886 ms
86,020 KB
testcase_39 AC 1,887 ms
86,116 KB
testcase_40 AC 1,885 ms
85,640 KB
testcase_41 AC 1,888 ms
85,492 KB
testcase_42 AC 1,886 ms
86,064 KB
testcase_43 AC 1,886 ms
86,148 KB
testcase_44 AC 1,887 ms
85,764 KB
testcase_45 AC 1,886 ms
86,184 KB
testcase_46 AC 1,886 ms
86,060 KB
testcase_47 AC 1,887 ms
85,896 KB
testcase_48 AC 1,887 ms
86,136 KB
testcase_49 AC 1,886 ms
86,144 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 = 2
# i = 0

while time.time() - ut < 1.8:
    # 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