結果

問題 No.2142 Segment Zero
ユーザー flygonflygon
提出日時 2022-12-02 21:52:50
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 534 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 1,095 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 259,084 KB
最終ジャッジ日時 2023-07-31 04:50:01
合計ジャッジ時間 15,131 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,392 KB
testcase_01 AC 506 ms
258,900 KB
testcase_02 AC 70 ms
71,344 KB
testcase_03 AC 496 ms
259,020 KB
testcase_04 AC 498 ms
258,876 KB
testcase_05 AC 504 ms
259,084 KB
testcase_06 AC 72 ms
71,308 KB
testcase_07 AC 483 ms
259,056 KB
testcase_08 AC 482 ms
258,788 KB
testcase_09 AC 478 ms
258,980 KB
testcase_10 AC 505 ms
258,908 KB
testcase_11 AC 506 ms
259,000 KB
testcase_12 AC 513 ms
259,044 KB
testcase_13 AC 506 ms
258,924 KB
testcase_14 AC 516 ms
258,852 KB
testcase_15 AC 534 ms
258,980 KB
testcase_16 AC 527 ms
258,980 KB
testcase_17 AC 455 ms
252,292 KB
testcase_18 AC 171 ms
149,948 KB
testcase_19 AC 158 ms
142,116 KB
testcase_20 AC 309 ms
256,284 KB
testcase_21 AC 345 ms
257,268 KB
testcase_22 AC 412 ms
250,480 KB
testcase_23 AC 163 ms
142,000 KB
testcase_24 AC 208 ms
179,012 KB
testcase_25 AC 237 ms
212,084 KB
testcase_26 AC 395 ms
258,564 KB
testcase_27 AC 412 ms
250,708 KB
testcase_28 AC 266 ms
229,280 KB
testcase_29 AC 316 ms
256,432 KB
testcase_30 AC 396 ms
250,448 KB
testcase_31 AC 383 ms
258,356 KB
testcase_32 AC 195 ms
168,304 KB
testcase_33 AC 127 ms
119,120 KB
testcase_34 AC 228 ms
212,800 KB
testcase_35 AC 494 ms
258,488 KB
testcase_36 AC 164 ms
149,188 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k = map(int,input().split())

a = [i for i in range(n+1)]
b = [n-i for i in range(n+1)]
sa = set([0])
sb = set([n])
flg = 0
for i in range(1,n+1): 
  a[i] += a[i-1]
  b[i] += b[i-1]
  sa.add(a[i])  
  sb.add(b[i])  

for i in range(1,n+1):
  if a[i] == k or a[i] == (n+1)*n//2 - k or k-a[i] in sb:
    flg = 1


print(1) if flg else print(2)
0