結果
問題 | No.2509 Beam Shateki |
ユーザー | miya145592 |
提出日時 | 2023-10-21 00:40:04 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,915 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 78,508 KB |
最終ジャッジ日時 | 2024-09-21 01:20:04 |
合計ジャッジ時間 | 26,472 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
53,632 KB |
testcase_01 | AC | 39 ms
52,608 KB |
testcase_02 | AC | 38 ms
52,608 KB |
testcase_03 | AC | 238 ms
78,072 KB |
testcase_04 | AC | 238 ms
78,176 KB |
testcase_05 | AC | 240 ms
77,944 KB |
testcase_06 | AC | 239 ms
77,932 KB |
testcase_07 | AC | 238 ms
78,196 KB |
testcase_08 | AC | 242 ms
77,944 KB |
testcase_09 | AC | 237 ms
77,940 KB |
testcase_10 | AC | 240 ms
78,068 KB |
testcase_11 | AC | 239 ms
78,192 KB |
testcase_12 | AC | 237 ms
78,064 KB |
testcase_13 | AC | 757 ms
77,712 KB |
testcase_14 | AC | 765 ms
77,856 KB |
testcase_15 | AC | 766 ms
77,916 KB |
testcase_16 | AC | 771 ms
77,848 KB |
testcase_17 | AC | 758 ms
77,804 KB |
testcase_18 | AC | 759 ms
77,808 KB |
testcase_19 | AC | 761 ms
77,728 KB |
testcase_20 | AC | 756 ms
77,980 KB |
testcase_21 | AC | 763 ms
77,848 KB |
testcase_22 | AC | 769 ms
77,872 KB |
testcase_23 | AC | 761 ms
77,848 KB |
testcase_24 | AC | 758 ms
77,804 KB |
testcase_25 | AC | 762 ms
78,236 KB |
testcase_26 | AC | 766 ms
77,800 KB |
testcase_27 | AC | 759 ms
77,848 KB |
testcase_28 | AC | 759 ms
77,976 KB |
testcase_29 | AC | 763 ms
77,976 KB |
testcase_30 | AC | 762 ms
77,844 KB |
testcase_31 | WA | - |
testcase_32 | AC | 758 ms
77,772 KB |
testcase_33 | AC | 147 ms
77,092 KB |
testcase_34 | AC | 296 ms
77,568 KB |
testcase_35 | AC | 468 ms
78,508 KB |
testcase_36 | AC | 217 ms
77,732 KB |
testcase_37 | AC | 98 ms
76,268 KB |
testcase_38 | AC | 215 ms
78,280 KB |
testcase_39 | AC | 215 ms
78,472 KB |
testcase_40 | AC | 340 ms
78,504 KB |
testcase_41 | AC | 97 ms
76,416 KB |
testcase_42 | AC | 250 ms
77,924 KB |
testcase_43 | AC | 547 ms
77,704 KB |
testcase_44 | AC | 605 ms
78,100 KB |
testcase_45 | AC | 222 ms
78,264 KB |
testcase_46 | AC | 277 ms
78,108 KB |
testcase_47 | AC | 597 ms
77,852 KB |
testcase_48 | AC | 280 ms
77,952 KB |
testcase_49 | AC | 376 ms
77,884 KB |
testcase_50 | AC | 412 ms
77,520 KB |
testcase_51 | AC | 149 ms
77,356 KB |
testcase_52 | AC | 332 ms
78,352 KB |
testcase_53 | AC | 48 ms
59,264 KB |
testcase_54 | AC | 46 ms
59,264 KB |
testcase_55 | AC | 51 ms
61,696 KB |
testcase_56 | AC | 50 ms
61,568 KB |
testcase_57 | AC | 52 ms
61,824 KB |
testcase_58 | WA | - |
testcase_59 | AC | 51 ms
61,312 KB |
testcase_60 | WA | - |
testcase_61 | AC | 51 ms
61,440 KB |
testcase_62 | AC | 52 ms
61,440 KB |
testcase_63 | WA | - |
ソースコード
import sys input = sys.stdin.readline H, W = map(int, input().split()) A = [list(map(int, input().split())) for _ in range(H)] ans = 0 for x in range(H+W+4): if 0<=x<=H+1: dir = [(0, 1), (1, 1), (-1, 1)] else: dir = [(1, 0), (1, 1), (1, -1)] for dx, dy in dir: sco = 0 S = set() if 0<=x<=H+1: nx = x ny = 0 else: nx = 0 ny = x-(H+2) nx+=dx ny+=dy if dx==0 or dy==0: while 1<=nx<=H and 1<=ny<=W: sco += A[nx-1][ny-1] S.add((nx, ny)) nx+=dx ny+=dy else: while 1<=ny<=W: if 1<=nx<=H and 1<=ny<=W: sco += A[nx-1][ny-1] S.add((nx, ny)) nx+=dx ny+=dy for x2 in range(x, H+W+4): if 0<=x2<=H+1: dir2 = [(0, 1), (1, 1), (-1, 1)] else: dir2 = [(1, 0), (1, 1), (1, -1)] for dx2, dy2 in dir2: sco2 = 0 if 0<=x2<=H+1: nx2 = x2 ny2 = 0 else: nx2 = 0 ny2 = x2-(H+2) nx2+=dx2 ny2+=dy2 if dx2==0 or dy2==0: while 1<=nx2<=H and 1<=ny2<=W: if (nx2, ny2) not in S: sco2 += A[nx2-1][ny2-1] nx2+=dx2 ny2+=dy2 else: while 1<=ny2<=W: if 1<=nx2<=H and 1<=ny2<=W: if (nx2, ny2) not in S: sco2 += A[nx2-1][ny2-1] nx2+=dx2 ny2+=dy2 ans = max(ans, sco+sco2) print(ans)