結果

問題 No.5016 Worst Mayor
ユーザー noriaoki
提出日時 2023-04-29 14:32:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 209 ms / 2,000 ms
コード長 837 bytes
コンパイル時間 512 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 94,960 KB
スコア 2,845,168,289
平均クエリ数 400.00
最終ジャッジ日時 2023-04-29 14:32:54
合計ジャッジ時間 13,556 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import random

# N = 3000, T = 400
N, T = map(int, input().split())
ABCD = [map(int, input().split()) for _ in range(N)]

block  = [[0] * 14 for _ in range(14)]
bridge = set()

def build():
    direction = [(1,0), (-1,0), (0,1), (0,-1)]
    while True:
        x = random.randint(0, 13)
        y = random.randint(0, 13)
        for i, v in direction:
            z = x + i
            w = y + v
            score = x + y * 14 + z * 14 ** 2 + w * 14 **3
            if 0 <= z <= 13 and 0 <= w <= 13 and not score in bridge:
                bridge.add(score)
                return x, y, z, w
            




for i in range(T):
    u, v = map(int, input().split())
    if i > 300:
        print(3)
    elif u * math.sqrt(v) < 10**7:
        print(2)
    else:
        x, y, z, w = build()
        print(1, x+1, y+1, z+1, w+1)
0