結果

問題 No.5017 Tool-assisted Shooting
ユーザー とろちゃとろちゃ
提出日時 2023-07-16 15:44:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 194 ms / 2,000 ms
コード長 3,002 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 94,460 KB
スコア 159,696
平均クエリ数 324.30
最終ジャッジ日時 2023-07-16 15:44:37
合計ジャッジ時間 19,011 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 150 ms
92,692 KB
testcase_01 AC 129 ms
92,796 KB
testcase_02 AC 145 ms
92,424 KB
testcase_03 AC 135 ms
92,880 KB
testcase_04 AC 113 ms
92,116 KB
testcase_05 AC 132 ms
92,424 KB
testcase_06 AC 143 ms
92,428 KB
testcase_07 AC 118 ms
92,472 KB
testcase_08 AC 131 ms
92,496 KB
testcase_09 AC 135 ms
92,160 KB
testcase_10 AC 150 ms
93,316 KB
testcase_11 AC 131 ms
92,580 KB
testcase_12 AC 123 ms
92,264 KB
testcase_13 AC 117 ms
92,028 KB
testcase_14 AC 150 ms
92,960 KB
testcase_15 AC 138 ms
92,536 KB
testcase_16 AC 112 ms
92,568 KB
testcase_17 AC 140 ms
92,848 KB
testcase_18 AC 147 ms
92,712 KB
testcase_19 AC 116 ms
92,656 KB
testcase_20 AC 142 ms
92,976 KB
testcase_21 AC 112 ms
92,492 KB
testcase_22 AC 130 ms
92,292 KB
testcase_23 AC 121 ms
92,568 KB
testcase_24 AC 118 ms
92,900 KB
testcase_25 AC 122 ms
92,168 KB
testcase_26 AC 120 ms
93,036 KB
testcase_27 AC 120 ms
92,740 KB
testcase_28 AC 133 ms
92,236 KB
testcase_29 AC 156 ms
92,992 KB
testcase_30 AC 130 ms
92,396 KB
testcase_31 AC 129 ms
92,832 KB
testcase_32 AC 159 ms
93,164 KB
testcase_33 AC 124 ms
92,192 KB
testcase_34 AC 146 ms
92,952 KB
testcase_35 AC 119 ms
92,436 KB
testcase_36 AC 113 ms
92,108 KB
testcase_37 AC 113 ms
92,160 KB
testcase_38 AC 165 ms
92,940 KB
testcase_39 AC 122 ms
92,688 KB
testcase_40 AC 160 ms
93,148 KB
testcase_41 AC 140 ms
92,968 KB
testcase_42 AC 165 ms
93,044 KB
testcase_43 AC 125 ms
92,392 KB
testcase_44 AC 113 ms
92,752 KB
testcase_45 AC 134 ms
92,412 KB
testcase_46 AC 137 ms
92,820 KB
testcase_47 AC 121 ms
92,404 KB
testcase_48 AC 147 ms
93,032 KB
testcase_49 AC 117 ms
92,516 KB
testcase_50 AC 141 ms
92,856 KB
testcase_51 AC 130 ms
92,776 KB
testcase_52 AC 116 ms
92,616 KB
testcase_53 AC 129 ms
92,684 KB
testcase_54 AC 124 ms
92,396 KB
testcase_55 AC 133 ms
92,596 KB
testcase_56 AC 113 ms
92,164 KB
testcase_57 AC 110 ms
92,792 KB
testcase_58 AC 129 ms
92,312 KB
testcase_59 AC 122 ms
92,528 KB
testcase_60 AC 150 ms
92,740 KB
testcase_61 AC 139 ms
92,392 KB
testcase_62 AC 193 ms
93,420 KB
testcase_63 AC 157 ms
93,188 KB
testcase_64 AC 109 ms
92,292 KB
testcase_65 AC 194 ms
94,460 KB
testcase_66 AC 178 ms
93,468 KB
testcase_67 AC 119 ms
92,584 KB
testcase_68 AC 114 ms
92,300 KB
testcase_69 AC 149 ms
93,432 KB
testcase_70 AC 129 ms
92,248 KB
testcase_71 AC 109 ms
92,296 KB
testcase_72 AC 116 ms
92,496 KB
testcase_73 AC 135 ms
92,416 KB
testcase_74 AC 124 ms
92,392 KB
testcase_75 AC 108 ms
92,564 KB
testcase_76 AC 151 ms
92,572 KB
testcase_77 AC 174 ms
93,160 KB
testcase_78 AC 118 ms
92,712 KB
testcase_79 AC 128 ms
92,384 KB
testcase_80 AC 146 ms
92,680 KB
testcase_81 AC 131 ms
92,380 KB
testcase_82 AC 145 ms
92,668 KB
testcase_83 AC 130 ms
93,016 KB
testcase_84 AC 147 ms
93,320 KB
testcase_85 AC 106 ms
92,388 KB
testcase_86 AC 110 ms
92,440 KB
testcase_87 AC 114 ms
92,604 KB
testcase_88 AC 179 ms
93,268 KB
testcase_89 AC 126 ms
92,868 KB
testcase_90 AC 117 ms
92,728 KB
testcase_91 AC 125 ms
92,612 KB
testcase_92 AC 120 ms
92,104 KB
testcase_93 AC 131 ms
92,312 KB
testcase_94 AC 128 ms
92,776 KB
testcase_95 AC 159 ms
93,220 KB
testcase_96 AC 153 ms
93,672 KB
testcase_97 AC 149 ms
93,064 KB
testcase_98 AC 164 ms
93,104 KB
testcase_99 AC 119 ms
91,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# import pypyjit;pypyjit.set_param("max_unroll_recursion=-1")
# from bisect import *
# from collections import *
# from heapq import *
# from itertools import *
# from math import *
# from datetime import *
# from decimal import *  # PyPyだと遅い
# from string import ascii_lowercase, ascii_uppercase
# import numpy as np
import sys
import os

# sys.setrecursionlimit(10**6)  # PyPyだと遅い
INF = 10**18
MOD = 998244353
# MOD = 10**9 + 7
isTest = os.path.exists("input.txt")
File = open("input.txt", "r") if isTest else sys.stdin


def input():
    return File.readline()[:-1]


# ///////////////////////////////////////////////////////////////////////////

if isTest:
    P = list(map(int, input().split()))
    outFile = open("output.txt", "w")


# 盤面を動かす関数
def moveGrid(grid):
    for i in range(1, 60):
        for j in range(25):
            grid[i - 1][j] = grid[i][j]
            if i == 59:
                grid[i][j] = (0, 0, 0)


# 敵までの距離を求める関数
def distance(grid, now):
    for i in range(60):
        if grid[i][now][0]:
            return i
    return -1


you = 12
move = ["S", "R", "L"]
score = 0
turn = 0
total_power = 0
grid = [[(0, 0, 0) for _ in range(25)] for _ in range(60)]
while True:
    n = int(input())
    if n == -1:
        break
    enemy = [list(map(int, input().split())) for _ in range(n)]
    moveGrid(grid)
    for h, p, x in enemy:
        grid[59][x] = (h, p, h)

    ans = 0
    dist = distance(grid, you)
    if dist == -1:
        if you == 0:
            ans = 1
        elif you == 24:
            ans = -1
        else:
            distL = distance(grid, you - 1) - 1
            distR = distance(grid, you + 1) - 1
            if grid[distL][you - 1][0] > distL * (total_power // 100 + 1) or distL < 0:
                ans = 1
            else:
                ans = -1
    else:
        if grid[dist][you][0] > dist * (total_power // 100 + 1):
            if you == 0:
                ans = 1
            elif you == 24:
                ans = -1
            else:
                distL = distance(grid, you - 1) - 1
                distR = distance(grid, you + 1) - 1
                if (
                    grid[distL][you - 1][0] > distL * (total_power // 100 + 1)
                    and distL > 0
                ):
                    ans = 1
                else:
                    ans = -1
        else:
            grid[dist][you] = (
                grid[dist][you][0] - (total_power // 100 + 1),
                grid[dist][you][1],
                grid[dist][you][2],
            )
            if grid[dist][you][0] <= 0:
                score += grid[dist][you][2]
                total_power += grid[dist][you][1]
                grid[dist][you] = (0, 0, 0)

    you = you + ans
    # print(me)

    if isTest:
        outFile.write(move[ans] + "\n")
    else:
        print(move[ans], flush=True)

    turn += 1
    if turn == 1000:
        break

# print(score)
if isTest:
    outFile.close()
0