結果

問題 No.5008 [Cherry Alpha] Discrete Pendulum with Air Resistance
ユーザー Akijin_007Akijin_007
提出日時 2022-10-15 00:22:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 2,486 bytes
コンパイル時間 580 ms
実行使用メモリ 76,836 KB
スコア 1,004,030,755,519,630
最終ジャッジ日時 2022-10-15 00:22:36
合計ジャッジ時間 13,742 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
76,568 KB
testcase_01 AC 92 ms
76,664 KB
testcase_02 AC 92 ms
76,572 KB
testcase_03 AC 92 ms
76,636 KB
testcase_04 AC 92 ms
76,560 KB
testcase_05 AC 91 ms
76,544 KB
testcase_06 AC 97 ms
76,652 KB
testcase_07 AC 91 ms
76,500 KB
testcase_08 AC 91 ms
76,576 KB
testcase_09 AC 91 ms
76,720 KB
testcase_10 AC 91 ms
76,716 KB
testcase_11 AC 86 ms
76,732 KB
testcase_12 AC 87 ms
76,556 KB
testcase_13 AC 98 ms
76,512 KB
testcase_14 AC 88 ms
76,564 KB
testcase_15 AC 88 ms
76,632 KB
testcase_16 AC 88 ms
76,568 KB
testcase_17 AC 89 ms
76,652 KB
testcase_18 AC 90 ms
76,772 KB
testcase_19 AC 103 ms
76,700 KB
testcase_20 AC 89 ms
76,516 KB
testcase_21 AC 91 ms
76,568 KB
testcase_22 AC 91 ms
76,600 KB
testcase_23 AC 90 ms
76,700 KB
testcase_24 AC 90 ms
76,660 KB
testcase_25 AC 101 ms
76,600 KB
testcase_26 AC 90 ms
76,728 KB
testcase_27 AC 91 ms
76,632 KB
testcase_28 AC 91 ms
76,784 KB
testcase_29 AC 89 ms
76,732 KB
testcase_30 AC 91 ms
76,508 KB
testcase_31 AC 104 ms
76,652 KB
testcase_32 AC 91 ms
76,796 KB
testcase_33 AC 90 ms
76,564 KB
testcase_34 AC 92 ms
76,648 KB
testcase_35 AC 89 ms
76,560 KB
testcase_36 AC 92 ms
76,572 KB
testcase_37 AC 105 ms
76,568 KB
testcase_38 AC 91 ms
76,636 KB
testcase_39 AC 90 ms
76,588 KB
testcase_40 AC 89 ms
76,796 KB
testcase_41 AC 89 ms
76,552 KB
testcase_42 AC 90 ms
76,704 KB
testcase_43 AC 99 ms
76,768 KB
testcase_44 AC 89 ms
76,548 KB
testcase_45 AC 89 ms
76,836 KB
testcase_46 AC 88 ms
76,540 KB
testcase_47 AC 90 ms
76,712 KB
testcase_48 AC 89 ms
76,704 KB
testcase_49 AC 90 ms
76,704 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

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

B = [0] * N
M = [0] * N
E = [0] * N

m = 3

for i in range(N):
    B[i] = random.randint(1, m)
    M[i] = random.randint(1, B[i])
    E[i] = random.randint(1, m)

# 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])



0