結果
問題 | No.5016 Worst Mayor |
ユーザー |
![]() |
提出日時 | 2023-04-29 14:41:56 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 255 ms / 2,000 ms |
コード長 | 1,655 bytes |
コンパイル時間 | 540 ms |
コンパイル使用メモリ | 87,264 KB |
実行使用メモリ | 94,452 KB |
スコア | 5,243,730,329 |
平均クエリ数 | 400.00 |
最終ジャッジ日時 | 2023-04-29 14:42:15 |
合計ジャッジ時間 | 15,637 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
純コード判定しない問題か言語 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 50 |
ソースコード
def calc_cost():a = int(10 ** 7 / supporter ** 0.5 + 2)while supporter * a ** 2 > 10 ** 14:a -= 1return adef execute(key, param = None):global supporter, moneyif key == 1:print(1, *param)money -= costelif key == 2:print(2)supporter += 1elif key == 3:print(3)money += 50000else:assert 0, "Execute Key Error"from random import randrangeDEBUG = 0N, T = map(int, input().split())supporter = 1money = 10 ** 6for _ in range(N):a, b, c, d = map(int, input().split())M = 14done = [[[0] * M for _ in range(M - 1)], [[0] * (M - 1) for _ in range(M)]]priority = [(0, 6, 6), (1, 6, 6), (0, 6, 7)]for q in range(T):u, v = map(int, input().split())cost = calc_cost()if DEBUG:print("cost =", cost, "u, v =", u, v)if u >= cost:if cost > (T - 1 - q) * 40000:execute(3)continuewhile 1:for t, i, j in priority:if done[t][i][j] == 0:breakelse:t = randrange(2)if t == 0:i = randrange(0, M - 1)j = randrange(0, M - 0)else:i = randrange(0, M - 0)j = randrange(0, M - 1)if done[t][i][j] == 0:breakcontinuebreakdone[t][i][j] = 1if t == 0:ni, nj = i + 1, jelse:ni, nj = i, j + 1execute(1, (i + 1, j + 1, ni + 1, nj + 1))else:execute(2)