結果
| 問題 |
No.5016 Worst Mayor
|
| コンテスト | |
| ユーザー |
Kiri8128
|
| 提出日時 | 2023-04-29 14:36:46 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,608 bytes |
| コンパイル時間 | 497 ms |
| コンパイル使用メモリ | 87,268 KB |
| 実行使用メモリ | 114,080 KB |
| スコア | 0 |
| 最終ジャッジ日時 | 2023-04-29 14:36:54 |
| 合計ジャッジ時間 | 7,404 ms |
|
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 49 |
ソースコード
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
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)]
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)
continue
while 1:
for t, i, j in priority:
if done[t][i][j] == 0:
break
else:
t = randrange(2)
if t == 0:
i = randrange(2, M - 3)
j = randrange(2, M - 2)
else:
i = randrange(2, M - 2)
j = randrange(2, M - 3)
if done[t][i][j] == 0:
break
continue
break
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(2)
Kiri8128