結果
問題 | No.5017 Tool-assisted Shooting |
ユーザー | とろちゃ |
提出日時 | 2023-07-16 15:58:48 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 248 ms / 2,000 ms |
コード長 | 4,475 bytes |
コンパイル時間 | 456 ms |
コンパイル使用メモリ | 87,124 KB |
実行使用メモリ | 94,804 KB |
スコア | 1,498,424 |
平均クエリ数 | 902.68 |
最終ジャッジ日時 | 2023-07-16 15:59:15 |
合計ジャッジ時間 | 25,047 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 203 ms
93,888 KB |
testcase_01 | AC | 123 ms
92,192 KB |
testcase_02 | AC | 207 ms
93,764 KB |
testcase_03 | AC | 199 ms
93,392 KB |
testcase_04 | AC | 114 ms
92,296 KB |
testcase_05 | AC | 194 ms
93,444 KB |
testcase_06 | AC | 196 ms
93,208 KB |
testcase_07 | AC | 212 ms
93,588 KB |
testcase_08 | AC | 203 ms
93,796 KB |
testcase_09 | AC | 203 ms
93,340 KB |
testcase_10 | AC | 200 ms
93,728 KB |
testcase_11 | AC | 201 ms
93,632 KB |
testcase_12 | AC | 204 ms
93,096 KB |
testcase_13 | AC | 201 ms
93,712 KB |
testcase_14 | AC | 214 ms
94,568 KB |
testcase_15 | AC | 199 ms
93,412 KB |
testcase_16 | AC | 200 ms
93,144 KB |
testcase_17 | AC | 204 ms
93,480 KB |
testcase_18 | AC | 206 ms
93,460 KB |
testcase_19 | AC | 121 ms
92,268 KB |
testcase_20 | AC | 200 ms
93,548 KB |
testcase_21 | AC | 217 ms
94,804 KB |
testcase_22 | AC | 199 ms
93,344 KB |
testcase_23 | AC | 204 ms
93,912 KB |
testcase_24 | AC | 199 ms
94,044 KB |
testcase_25 | AC | 200 ms
94,144 KB |
testcase_26 | AC | 195 ms
94,044 KB |
testcase_27 | AC | 200 ms
94,024 KB |
testcase_28 | AC | 217 ms
93,568 KB |
testcase_29 | AC | 199 ms
93,580 KB |
testcase_30 | AC | 199 ms
93,964 KB |
testcase_31 | AC | 200 ms
93,568 KB |
testcase_32 | AC | 126 ms
92,844 KB |
testcase_33 | AC | 207 ms
93,912 KB |
testcase_34 | AC | 204 ms
93,872 KB |
testcase_35 | AC | 207 ms
93,224 KB |
testcase_36 | AC | 196 ms
93,856 KB |
testcase_37 | AC | 202 ms
93,208 KB |
testcase_38 | AC | 203 ms
93,264 KB |
testcase_39 | AC | 211 ms
93,872 KB |
testcase_40 | AC | 212 ms
93,492 KB |
testcase_41 | AC | 193 ms
93,788 KB |
testcase_42 | AC | 210 ms
94,312 KB |
testcase_43 | AC | 202 ms
93,656 KB |
testcase_44 | AC | 218 ms
94,176 KB |
testcase_45 | AC | 125 ms
92,632 KB |
testcase_46 | AC | 201 ms
93,872 KB |
testcase_47 | AC | 197 ms
93,244 KB |
testcase_48 | AC | 197 ms
93,500 KB |
testcase_49 | AC | 201 ms
93,656 KB |
testcase_50 | AC | 203 ms
93,168 KB |
testcase_51 | AC | 199 ms
93,204 KB |
testcase_52 | AC | 204 ms
93,720 KB |
testcase_53 | AC | 202 ms
93,252 KB |
testcase_54 | AC | 126 ms
92,748 KB |
testcase_55 | AC | 210 ms
93,424 KB |
testcase_56 | AC | 205 ms
93,464 KB |
testcase_57 | AC | 206 ms
93,892 KB |
testcase_58 | AC | 204 ms
94,052 KB |
testcase_59 | AC | 203 ms
93,992 KB |
testcase_60 | AC | 205 ms
93,796 KB |
testcase_61 | AC | 200 ms
93,484 KB |
testcase_62 | AC | 202 ms
93,728 KB |
testcase_63 | AC | 197 ms
93,644 KB |
testcase_64 | AC | 200 ms
94,028 KB |
testcase_65 | AC | 219 ms
94,660 KB |
testcase_66 | AC | 229 ms
93,348 KB |
testcase_67 | AC | 120 ms
92,180 KB |
testcase_68 | AC | 118 ms
92,180 KB |
testcase_69 | AC | 128 ms
92,632 KB |
testcase_70 | AC | 204 ms
93,844 KB |
testcase_71 | AC | 200 ms
93,492 KB |
testcase_72 | AC | 228 ms
93,828 KB |
testcase_73 | AC | 139 ms
92,368 KB |
testcase_74 | AC | 117 ms
92,172 KB |
testcase_75 | AC | 200 ms
93,444 KB |
testcase_76 | AC | 198 ms
93,788 KB |
testcase_77 | AC | 205 ms
93,496 KB |
testcase_78 | AC | 222 ms
93,360 KB |
testcase_79 | AC | 207 ms
94,264 KB |
testcase_80 | AC | 200 ms
93,888 KB |
testcase_81 | AC | 203 ms
93,848 KB |
testcase_82 | AC | 200 ms
93,492 KB |
testcase_83 | AC | 210 ms
93,996 KB |
testcase_84 | AC | 204 ms
93,684 KB |
testcase_85 | AC | 136 ms
92,668 KB |
testcase_86 | AC | 195 ms
93,816 KB |
testcase_87 | AC | 203 ms
93,644 KB |
testcase_88 | AC | 248 ms
94,340 KB |
testcase_89 | AC | 196 ms
93,724 KB |
testcase_90 | AC | 197 ms
93,416 KB |
testcase_91 | AC | 207 ms
93,772 KB |
testcase_92 | AC | 202 ms
93,548 KB |
testcase_93 | AC | 202 ms
93,364 KB |
testcase_94 | AC | 201 ms
93,732 KB |
testcase_95 | AC | 204 ms
93,560 KB |
testcase_96 | AC | 200 ms
93,440 KB |
testcase_97 | AC | 201 ms
93,660 KB |
testcase_98 | AC | 195 ms
93,288 KB |
testcase_99 | AC | 207 ms
93,620 KB |
ソースコード
# 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: distR = distance(grid, you + 1) flagR = distR == -1 or grid[distR][you + 1][0] <= (distR - 1) * ( total_power // 100 + 1 ) if flagR: ans = 1 else: ans = 0 elif you == 24: distL = distance(grid, you - 1) flagL = distL == -1 or grid[distL][you - 1][0] <= (distL - 1) * ( total_power // 100 + 1 ) if flagL: ans = -1 else: ans = 0 else: distL = distance(grid, you - 1) distR = distance(grid, you + 1) flagL = distL == -1 or grid[distL][you - 1][0] <= (distL - 1) * ( total_power // 100 + 1 ) flagR = distR == -1 or grid[distR][you + 1][0] <= (distR - 1) * ( total_power // 100 + 1 ) if flagL and flagR: if grid[distL][you - 1][2] > grid[distR][you + 1][2]: ans = -1 else: ans = 1 elif flagL and not flagR: ans = -1 elif not flagL and flagR: ans = 1 else: ans = 0 else: if grid[dist][you][0] > dist * (total_power // 100 + 1): if you == 0: distR = distance(grid, you + 1) flagR = distR == -1 or grid[distR][you + 1][0] <= (distR - 1) * ( total_power // 100 + 1 ) if flagR: ans = 1 else: ans = 0 elif you == 24: distL = distance(grid, you - 1) flagL = distL == -1 or grid[distL][you - 1][0] <= (distL - 1) * ( total_power // 100 + 1 ) if flagL: ans = -1 else: ans = 0 else: distL = distance(grid, you - 1) distR = distance(grid, you + 1) if ( grid[distL][you - 1][0] > (distL - 1) * (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()