結果

問題 No.5017 Tool-assisted Shooting
ユーザー とろちゃとろちゃ
提出日時 2023-07-16 18:53:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 3,457 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 87,148 KB
実行使用メモリ 95,344 KB
スコア 1,781,624
平均クエリ数 696.99
最終ジャッジ日時 2023-07-16 18:56:28
合計ジャッジ時間 27,638 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
純コード判定しない問題か言語
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 252 ms
95,048 KB
testcase_01 AC 181 ms
93,796 KB
testcase_02 AC 223 ms
94,124 KB
testcase_03 AC 251 ms
94,756 KB
testcase_04 AC 189 ms
94,412 KB
testcase_05 AC 148 ms
94,540 KB
testcase_06 AC 245 ms
94,360 KB
testcase_07 AC 164 ms
94,528 KB
testcase_08 AC 233 ms
94,660 KB
testcase_09 AC 229 ms
93,944 KB
testcase_10 AC 251 ms
93,752 KB
testcase_11 AC 253 ms
94,332 KB
testcase_12 AC 229 ms
94,396 KB
testcase_13 AC 180 ms
93,796 KB
testcase_14 AC 248 ms
93,844 KB
testcase_15 AC 248 ms
94,508 KB
testcase_16 AC 269 ms
94,304 KB
testcase_17 AC 252 ms
94,748 KB
testcase_18 AC 202 ms
94,536 KB
testcase_19 AC 227 ms
94,872 KB
testcase_20 AC 162 ms
93,936 KB
testcase_21 AC 246 ms
94,504 KB
testcase_22 AC 188 ms
93,780 KB
testcase_23 AC 203 ms
94,056 KB
testcase_24 AC 247 ms
93,792 KB
testcase_25 AC 177 ms
94,180 KB
testcase_26 AC 252 ms
95,092 KB
testcase_27 AC 182 ms
93,800 KB
testcase_28 AC 280 ms
94,072 KB
testcase_29 AC 204 ms
94,576 KB
testcase_30 AC 136 ms
94,248 KB
testcase_31 AC 160 ms
93,580 KB
testcase_32 AC 155 ms
94,152 KB
testcase_33 AC 277 ms
94,256 KB
testcase_34 AC 246 ms
94,224 KB
testcase_35 AC 196 ms
94,468 KB
testcase_36 AC 243 ms
94,728 KB
testcase_37 AC 248 ms
94,696 KB
testcase_38 AC 252 ms
94,616 KB
testcase_39 AC 273 ms
94,232 KB
testcase_40 AC 169 ms
94,400 KB
testcase_41 AC 147 ms
93,856 KB
testcase_42 AC 145 ms
93,684 KB
testcase_43 AC 279 ms
94,820 KB
testcase_44 AC 220 ms
94,112 KB
testcase_45 AC 166 ms
94,340 KB
testcase_46 AC 255 ms
95,344 KB
testcase_47 AC 273 ms
94,384 KB
testcase_48 AC 245 ms
94,944 KB
testcase_49 AC 286 ms
95,128 KB
testcase_50 AC 184 ms
94,556 KB
testcase_51 AC 143 ms
93,964 KB
testcase_52 AC 135 ms
93,704 KB
testcase_53 AC 226 ms
94,304 KB
testcase_54 AC 277 ms
93,932 KB
testcase_55 AC 164 ms
93,800 KB
testcase_56 AC 160 ms
94,356 KB
testcase_57 AC 221 ms
94,764 KB
testcase_58 AC 246 ms
94,616 KB
testcase_59 AC 158 ms
93,468 KB
testcase_60 AC 237 ms
94,044 KB
testcase_61 AC 251 ms
94,688 KB
testcase_62 AC 280 ms
95,008 KB
testcase_63 AC 251 ms
94,664 KB
testcase_64 AC 275 ms
95,028 KB
testcase_65 AC 154 ms
93,728 KB
testcase_66 AC 258 ms
93,908 KB
testcase_67 AC 231 ms
94,392 KB
testcase_68 AC 161 ms
94,264 KB
testcase_69 AC 282 ms
94,596 KB
testcase_70 AC 148 ms
93,620 KB
testcase_71 AC 154 ms
93,848 KB
testcase_72 AC 249 ms
94,268 KB
testcase_73 AC 139 ms
93,640 KB
testcase_74 AC 200 ms
94,364 KB
testcase_75 AC 262 ms
95,016 KB
testcase_76 AC 185 ms
93,788 KB
testcase_77 AC 254 ms
94,980 KB
testcase_78 AC 144 ms
94,012 KB
testcase_79 AC 254 ms
95,032 KB
testcase_80 AC 275 ms
94,500 KB
testcase_81 AC 253 ms
94,956 KB
testcase_82 AC 254 ms
94,748 KB
testcase_83 AC 247 ms
94,532 KB
testcase_84 AC 175 ms
94,312 KB
testcase_85 AC 254 ms
94,564 KB
testcase_86 AC 186 ms
94,556 KB
testcase_87 AC 148 ms
94,312 KB
testcase_88 AC 252 ms
94,000 KB
testcase_89 AC 153 ms
94,508 KB
testcase_90 AC 248 ms
94,220 KB
testcase_91 AC 276 ms
94,880 KB
testcase_92 AC 248 ms
94,768 KB
testcase_93 AC 247 ms
94,384 KB
testcase_94 AC 253 ms
94,656 KB
testcase_95 AC 270 ms
94,292 KB
testcase_96 AC 228 ms
94,452 KB
testcase_97 AC 240 ms
94,552 KB
testcase_98 AC 197 ms
94,052 KB
testcase_99 AC 244 ms
93,860 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
from random import *
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):
    if not 0 <= now <= 24:
        return -1
    for i in range(60):
        if grid[i][now][0]:
            return i
    return -1


# 列で得られるポイントを求める関数
def totalPoint(grid, idx):
    if not 0 <= idx <= 24:
        return -1

    total = 0
    dist = 0
    cnt = 0
    for i in range(60):
        if grid[i][idx][0]:
            if grid[i][idx][0] > (i - dist) * (total_power // 100 + 1):
                break
            dist = i
            total += grid[i][idx][2]
            cnt += 1
    else:
        return total
    if cnt == 0:
        if i != 0:
            rand = randint(0, 4)
            if rand == 0:
                return 1
        return -100
    else:
        return total


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)]
one = 1
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
    center = totalPoint(grid, you)
    left = totalPoint(grid, you - 1)
    right = totalPoint(grid, you + 1)
    if sum([i for i in [center, left, right] if i != -1]) == 0:
        if you == 0 or you == 24:
            one *= -1
        ans = one
        if one == 1:
            ans = 1
        else:
            ans = -1
    elif center == 0:
        if left == -100 and right == -100:
            ans = 0
        elif left > right:
            ans = -1
        else:
            ans = 1
    else:
        if center >= left and center >= right:
            ans = 0
        elif left >= center and left >= right:
            ans = -1
        elif right >= center and right >= left:
            ans = 1

    you = you + ans
    dist = distance(grid, you)

    if dist != -1:
        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)

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

    turn += 1
    if turn == 1000:
        break

if isTest:
    outFile.close()
0