結果

問題 No.5016 Worst Mayor
ユーザー Kiri8128Kiri8128
提出日時 2023-04-29 16:12:27
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 4,501 bytes
コンパイル時間 475 ms
コンパイル使用メモリ 87,356 KB
実行使用メモリ 26,048 KB
スコア 0
最終ジャッジ日時 2023-04-29 16:14:12
合計ジャッジ時間 7,189 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def calc_cost():
    a = int(10 ** 7 / supporter ** 0.5 + 2)
    while supporter * a ** 2 > 10 ** 14:
        a -= 1
    return a
def execute(key, param = None):
    global supporter, money
    if key == 1:
        print(1, *param)
        money -= cost
    elif key == 2:
        print(2)
        supporter += 1
    elif key == 3:
        print(3)
        money += 50000
    else:
        assert 0, "Execute Key Error"
from random import randrange
DEBUG = 0
N, T = map(int, input().split())
supporter = 1
money = 10 ** 6
for _ in range(N):
    a, b, c, d = map(int, input().split())

M = 14
done = [[[0] * M for _ in range(M - 1)], [[0] * (M - 1) for _ in range(M)]]
# priority = [(0, 6, 6), (1, 6, 6), (0, 6, 7)]
# priority = [(0, 6, 0), (1, 6, 0), (0, 6, 1), (1, 7, 1), (0, 6, 2), (1, 6, 2), (0, 6, 3), (1, 7, 3), (0, 6, 4), (1, 6, 4), (0, 6, 5), (1, 7, 5), (0, 6, 6), (1, 6, 6), (0, 6, 7), (1, 7, 7), (0, 6, 8), (1, 6, 8), (0, 6, 9), (1, 7, 9), (0, 6, 10), (1, 6, 10), (0, 6, 11), (1, 7, 11), (0, 6, 12), (1, 6, 12), (0, 6, 13), (0, 0, 0), (1, 0, 0), (0, 0, 1), (1, 1, 1), (0, 0, 2), (1, 0, 2), (0, 0, 3), (1, 1, 3), (0, 0, 4), (1, 0, 4), (0, 0, 5), (1, 1, 5), (0, 0, 6), (1, 0, 6), (0, 0, 7), (1, 1, 7), (0, 0, 8), (1, 0, 8), (0, 0, 9), (1, 1, 9), (0, 0, 10), (1, 0, 10), (0, 0, 11), (1, 1, 11), (0, 0, 12), (1, 0, 12), (0, 0, 13), (0, 12, 0), (1, 12, 0), (0, 12, 1), (1, 13, 1), (0, 12, 2), (1, 12, 2), (0, 12, 3), (1, 13, 3), (0, 12, 4), (1, 12, 4), (0, 12, 5), (1, 13, 5), (0, 12, 6), (1, 12, 6), (0, 12, 7), (1, 13, 7), (0, 12, 8), (1, 12, 8), (0, 12, 9), (1, 13, 9), (0, 12, 10), (1, 12, 10), (0, 12, 11), (1, 13, 11), (0, 12, 12), (1, 12, 12), (0, 12, 13), (0, 1, 7), (1, 2, 6), (0, 2, 6), (1, 3, 6), (0, 3, 7), (1, 4, 6), (0, 4, 6), (1, 5, 6), (0, 5, 7), (0, 7, 6), (1, 8, 6), (0, 8, 7), (1, 9, 6), (0, 9, 6), (1, 10, 6), (0, 10, 7), (1, 11, 6), (0, 11, 6), (0, 1, 1), (1, 2, 0), (0, 2, 0), (1, 3, 0), (0, 3, 1), (1, 4, 0), (0, 4, 0), (1, 5, 0), (0, 5, 1), (0, 7, 0), (1, 8, 0), (0, 8, 1), (1, 9, 0), (0, 9, 0), (1, 10, 0), (0, 10, 1), (1, 11, 0), (0, 11, 0), (0, 1, 13), (1, 2, 12), (0, 2, 12), (1, 3, 12), (0, 3, 13), (1, 4, 12), (0, 4, 12), (1, 5, 12), (0, 5, 13), (0, 7, 12), (1, 8, 12), (0, 8, 13), (1, 9, 12), (0, 9, 12), (1, 10, 12), (0, 10, 13), (1, 11, 12), (0, 11, 12)][::-1]
priority = [(0, 6, 6), (1, 7, 5), (0, 6, 5), (1, 6, 4), (0, 6, 4), (1, 7, 3), (0, 6, 3), (1, 6, 2), (0, 6, 2), (1, 7, 1), (0, 6, 1), (1, 6, 0), (0, 6, 0), (1, 6, 6), (0, 6, 7), (1, 7, 7), (0, 6, 8), (1, 6, 8), (0, 6, 9), (1, 7, 9), (0, 6, 10), (1, 6, 10), (0, 6, 11), (1, 7, 11), (0, 6, 12), (1, 6, 12), (0, 6, 13), (0, 0, 6), (1, 1, 5), (0, 0, 5), (1, 0, 4), (0, 0, 4), (1, 1, 3), (0, 0, 3), (1, 0, 2), (0, 0, 2), (1, 1, 1), (0, 0, 1), (1, 0, 0), (0, 0, 0), (1, 0, 6), (0, 0, 7), (1, 1, 7), (0, 0, 8), (1, 0, 8), (0, 0, 9), (1, 1, 9), (0, 0, 10), (1, 0, 10), (0, 0, 11), (1, 1, 11), (0, 0, 12), (1, 0, 12), (0, 0, 13), (1, 13, 6), (0, 12, 6), (1, 12, 5), (0, 12, 5), (1, 13, 4), (0, 12, 4), (1, 12, 3), (0, 12, 3), (1, 13, 2), (0, 12, 2), (1, 12, 1), (0, 12, 1), (1, 13, 0), (0, 12, 0), (0, 12, 7), (1, 12, 7), (0, 12, 8), (1, 13, 8), (0, 12, 9), (1, 12, 9), (0, 12, 10), (1, 13, 10), (0, 12, 11), (1, 12, 11), (0, 12, 12), (1, 13, 12), (0, 12, 13), (1, 12, 13), (0, 5, 7), (1, 5, 6), (0, 4, 6), (1, 4, 6), (0, 3, 7), (1, 3, 6), (0, 2, 6), (1, 2, 6), (0, 1, 7), (0, 7, 6), (1, 8, 6), (0, 8, 7), (1, 9, 6), (0, 9, 6), (1, 10, 6), (0, 10, 7), (1, 11, 6), (0, 11, 6), (0, 5, 1), (1, 5, 0), (0, 4, 0), (1, 4, 0), (0, 3, 1), (1, 3, 0), (0, 2, 0), (1, 2, 0), (0, 1, 1), (0, 7, 0), (1, 8, 0), (0, 8, 1), (1, 9, 0), (0, 9, 0), (1, 10, 0), (0, 10, 1), (1, 11, 0), (0, 11, 0), (0, 5, 13), (1, 5, 12), (0, 4, 12), (1, 4, 12), (0, 3, 13), (1, 3, 12), (0, 2, 12), (1, 2, 12), (0, 1, 13), (0, 7, 12), (1, 8, 12), (0, 8, 13), (1, 9, 12), (0, 9, 12), (1, 10, 12), (0, 10, 13), (1, 11, 12), (0, 11, 12)][::-1]
for q in range(T):
    u, v = map(int, input().split())
    cost = calc_cost()
    if DEBUG:
        print("cost =", cost, "u, v =", u, v)
    if q < 20:
        execute(3)
        continue
    if u >= cost:
        if cost > (T - 1 - q) * 40000:
            execute(3)
            continue
        if priority:
            t, i, j = priority.pop()
            done[t][i][j] = 1
            if t == 0:
                ni, nj = i + 1, j
            else:
                ni, nj = i, j + 1
            execute(1, (i + 1, j + 1, ni + 1, nj + 1))
        else:
            execute(3)
    else:
        execute(2)
0