結果

問題 No.5017 Tool-assisted Shooting
ユーザー netyo715netyo715
提出日時 2023-07-16 16:16:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 416 ms / 2,000 ms
コード長 2,513 bytes
コンパイル時間 659 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 100,496 KB
スコア 4,111,390
平均クエリ数 1000.00
最終ジャッジ日時 2023-07-16 16:16:53
合計ジャッジ時間 42,755 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 408 ms
99,068 KB
testcase_01 AC 366 ms
97,828 KB
testcase_02 AC 358 ms
98,012 KB
testcase_03 AC 391 ms
98,604 KB
testcase_04 AC 369 ms
97,520 KB
testcase_05 AC 351 ms
98,464 KB
testcase_06 AC 363 ms
98,636 KB
testcase_07 AC 394 ms
98,680 KB
testcase_08 AC 352 ms
98,168 KB
testcase_09 AC 362 ms
98,132 KB
testcase_10 AC 403 ms
98,320 KB
testcase_11 AC 362 ms
97,952 KB
testcase_12 AC 363 ms
97,788 KB
testcase_13 AC 387 ms
98,368 KB
testcase_14 AC 364 ms
98,092 KB
testcase_15 AC 349 ms
97,972 KB
testcase_16 AC 379 ms
98,104 KB
testcase_17 AC 398 ms
98,264 KB
testcase_18 AC 371 ms
97,940 KB
testcase_19 AC 406 ms
98,000 KB
testcase_20 AC 361 ms
98,720 KB
testcase_21 AC 360 ms
98,660 KB
testcase_22 AC 386 ms
98,128 KB
testcase_23 AC 358 ms
98,136 KB
testcase_24 AC 373 ms
98,196 KB
testcase_25 AC 402 ms
99,104 KB
testcase_26 AC 372 ms
98,396 KB
testcase_27 AC 352 ms
98,404 KB
testcase_28 AC 383 ms
98,912 KB
testcase_29 AC 362 ms
97,964 KB
testcase_30 AC 363 ms
98,124 KB
testcase_31 AC 409 ms
100,496 KB
testcase_32 AC 359 ms
98,864 KB
testcase_33 AC 368 ms
98,224 KB
testcase_34 AC 386 ms
98,716 KB
testcase_35 AC 395 ms
98,256 KB
testcase_36 AC 376 ms
99,456 KB
testcase_37 AC 397 ms
98,988 KB
testcase_38 AC 362 ms
97,900 KB
testcase_39 AC 362 ms
99,016 KB
testcase_40 AC 389 ms
98,396 KB
testcase_41 AC 367 ms
98,096 KB
testcase_42 AC 361 ms
98,012 KB
testcase_43 AC 388 ms
98,904 KB
testcase_44 AC 361 ms
98,176 KB
testcase_45 AC 371 ms
98,484 KB
testcase_46 AC 393 ms
98,364 KB
testcase_47 AC 365 ms
98,868 KB
testcase_48 AC 373 ms
98,468 KB
testcase_49 AC 357 ms
99,300 KB
testcase_50 AC 361 ms
99,228 KB
testcase_51 AC 360 ms
98,020 KB
testcase_52 AC 388 ms
97,480 KB
testcase_53 AC 353 ms
97,984 KB
testcase_54 AC 365 ms
98,112 KB
testcase_55 AC 356 ms
98,380 KB
testcase_56 AC 369 ms
99,356 KB
testcase_57 AC 369 ms
97,872 KB
testcase_58 AC 365 ms
98,720 KB
testcase_59 AC 364 ms
97,684 KB
testcase_60 AC 387 ms
98,856 KB
testcase_61 AC 346 ms
98,096 KB
testcase_62 AC 368 ms
98,512 KB
testcase_63 AC 362 ms
98,420 KB
testcase_64 AC 374 ms
97,888 KB
testcase_65 AC 381 ms
99,464 KB
testcase_66 AC 400 ms
97,908 KB
testcase_67 AC 362 ms
98,472 KB
testcase_68 AC 354 ms
98,476 KB
testcase_69 AC 384 ms
98,352 KB
testcase_70 AC 363 ms
98,632 KB
testcase_71 AC 349 ms
98,072 KB
testcase_72 AC 365 ms
98,148 KB
testcase_73 AC 381 ms
99,016 KB
testcase_74 AC 358 ms
98,276 KB
testcase_75 AC 383 ms
97,976 KB
testcase_76 AC 369 ms
98,088 KB
testcase_77 AC 361 ms
98,448 KB
testcase_78 AC 384 ms
98,644 KB
testcase_79 AC 377 ms
98,480 KB
testcase_80 AC 363 ms
98,596 KB
testcase_81 AC 380 ms
98,416 KB
testcase_82 AC 354 ms
98,444 KB
testcase_83 AC 382 ms
98,772 KB
testcase_84 AC 416 ms
99,384 KB
testcase_85 AC 373 ms
98,048 KB
testcase_86 AC 374 ms
99,216 KB
testcase_87 AC 396 ms
98,028 KB
testcase_88 AC 366 ms
98,684 KB
testcase_89 AC 349 ms
98,988 KB
testcase_90 AC 384 ms
99,092 KB
testcase_91 AC 367 ms
98,068 KB
testcase_92 AC 363 ms
98,140 KB
testcase_93 AC 401 ms
98,004 KB
testcase_94 AC 382 ms
97,896 KB
testcase_95 AC 362 ms
98,056 KB
testcase_96 AC 383 ms
98,768 KB
testcase_97 AC 365 ms
98,556 KB
testcase_98 AC 349 ms
98,864 KB
testcase_99 AC 399 ms
98,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
from random import randint
H = 60
W = 25
board = deque([[[-1, -1] for _ in range(W)] for _ in range(H)])
level = 1
power = 0
jiki_w = 12
def min_dist(w1, w2):
    if w1 == w2:
        return 0, 0
    if w1 < w2:
        if w2-w1 <= 12:
            return w2-w1, 1
        else:
            return 25-(w2-w1), 2
    if w1 > w2:
        if w1-w2 <= 12:
            return w1-w2, 2
        else:
            return 25-(w1-w2), 1
    return -1, -1
for turn in range(1000):
    board.popleft()
    board.append([[-1, -1] for _ in range(W)])
    
    N = int(input())
    if N==-1:
        exit()
    for _ in range(N):
        h, p, x = map(int, input().split())
        board[59][x] = [h, p]
    
    next_perf = 0
    next_w = randint(0, W-1)
    for w in range(W):
        is_first = True
        c_pow = 0
        c_turn = 0
        for h in range(H):
            hp, pow = board[h][w]
            if hp == -1:
                continue
            dist, d = min_dist(jiki_w, w)
            if not is_first:
                dist = 0
            a_turn = h-dist-c_turn
            if a_turn <= 0:
                break
            if a_turn*level < hp:
                break
            if is_first:
                gekiha_turn = dist + -(-hp//level)
            else:
                gekiha_turn = c_turn + -(-hp//level)
            perf = pow/gekiha_turn
            if perf > next_perf:
                next_perf = perf
                next_w = w
            c_pow += pow
            c_turn = gekiha_turn

    dist, d = min_dist(jiki_w, next_w)
    if d==1 and board[0][(jiki_w+1)%W][0] == board[1][(jiki_w+1)%W][0] == -1:
        print("R")
        jiki_w += 1
    elif d==2 and board[0][(jiki_w-1)%W][0] == board[1][(jiki_w-1)%W][0] == -1:
        print("L")
        jiki_w -= 1
    else:
        if board[1][jiki_w][0] > level:
            if board[0][(jiki_w-1)%W][0] == board[1][(jiki_w-1)%W][0] == -1:
                print("L")
                jiki_w -= 1
            elif board[0][(jiki_w+1)%W][0] == board[1][(jiki_w+1)%W][0] == -1:
                print("R")
                jiki_w += 1
            else:
                print("S")
        else:
            print("S")
    
    jiki_w %= W
    for h in range(H):
        if board[h][jiki_w][0] == -1:
            continue
        board[h][jiki_w][0] -= level
        if board[h][jiki_w][0] <= 0:
            power += board[h][jiki_w][1]
            level = 1+power//100
            board[h][jiki_w] = [-1, -1]
        break
0