結果
問題 | No.2142 Segment Zero |
ユーザー | mkawa2 |
提出日時 | 2022-12-02 22:05:11 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 351 ms / 2,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 291 ms |
コンパイル使用メモリ | 82,272 KB |
実行使用メモリ | 226,916 KB |
最終ジャッジ日時 | 2024-04-18 06:06:13 |
合計ジャッジ時間 | 7,810 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
52,944 KB |
testcase_01 | AC | 331 ms
225,384 KB |
testcase_02 | AC | 40 ms
52,248 KB |
testcase_03 | AC | 45 ms
53,332 KB |
testcase_04 | AC | 293 ms
225,340 KB |
testcase_05 | AC | 336 ms
225,544 KB |
testcase_06 | AC | 44 ms
52,812 KB |
testcase_07 | AC | 112 ms
104,492 KB |
testcase_08 | AC | 338 ms
225,724 KB |
testcase_09 | AC | 164 ms
161,036 KB |
testcase_10 | AC | 293 ms
225,808 KB |
testcase_11 | AC | 258 ms
225,400 KB |
testcase_12 | AC | 293 ms
225,520 KB |
testcase_13 | AC | 341 ms
225,796 KB |
testcase_14 | AC | 273 ms
225,172 KB |
testcase_15 | AC | 279 ms
226,916 KB |
testcase_16 | AC | 351 ms
225,220 KB |
testcase_17 | AC | 289 ms
194,092 KB |
testcase_18 | AC | 52 ms
64,000 KB |
testcase_19 | AC | 76 ms
79,720 KB |
testcase_20 | AC | 184 ms
150,796 KB |
testcase_21 | AC | 161 ms
132,716 KB |
testcase_22 | AC | 220 ms
180,424 KB |
testcase_23 | AC | 77 ms
90,916 KB |
testcase_24 | AC | 90 ms
108,564 KB |
testcase_25 | AC | 77 ms
91,312 KB |
testcase_26 | AC | 139 ms
141,044 KB |
testcase_27 | AC | 94 ms
103,956 KB |
testcase_28 | AC | 136 ms
133,104 KB |
testcase_29 | AC | 141 ms
150,016 KB |
testcase_30 | AC | 198 ms
180,880 KB |
testcase_31 | AC | 46 ms
63,816 KB |
testcase_32 | AC | 91 ms
98,340 KB |
testcase_33 | AC | 65 ms
78,100 KB |
testcase_34 | AC | 94 ms
99,084 KB |
testcase_35 | AC | 275 ms
224,960 KB |
testcase_36 | AC | 83 ms
94,848 KB |
ソースコード
import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 n, k = LI() d = n*(n+1)//2-k s = 0 st = set() st.add(0) for i in range(1, n+1): s += i if s-d in st: print(1) exit() st.add(s) print(2)