結果

問題 No.2142 Segment Zero
ユーザー flygonflygon
提出日時 2022-12-02 21:52:50
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 632 ms / 2,000 ms
コード長 343 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 245,536 KB
最終ジャッジ日時 2024-04-18 05:46:43
合計ジャッジ時間 15,987 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,096 KB
testcase_01 AC 613 ms
245,052 KB
testcase_02 AC 42 ms
52,096 KB
testcase_03 AC 623 ms
245,536 KB
testcase_04 AC 611 ms
245,148 KB
testcase_05 AC 605 ms
245,276 KB
testcase_06 AC 41 ms
52,096 KB
testcase_07 AC 632 ms
245,004 KB
testcase_08 AC 610 ms
245,008 KB
testcase_09 AC 607 ms
245,268 KB
testcase_10 AC 605 ms
245,260 KB
testcase_11 AC 599 ms
245,204 KB
testcase_12 AC 593 ms
245,028 KB
testcase_13 AC 594 ms
245,004 KB
testcase_14 AC 591 ms
245,268 KB
testcase_15 AC 584 ms
245,268 KB
testcase_16 AC 598 ms
245,396 KB
testcase_17 AC 491 ms
238,208 KB
testcase_18 AC 150 ms
135,936 KB
testcase_19 AC 142 ms
128,768 KB
testcase_20 AC 343 ms
242,816 KB
testcase_21 AC 375 ms
243,456 KB
testcase_22 AC 446 ms
245,120 KB
testcase_23 AC 142 ms
128,896 KB
testcase_24 AC 199 ms
165,376 KB
testcase_25 AC 248 ms
198,844 KB
testcase_26 AC 437 ms
244,736 KB
testcase_27 AC 440 ms
245,120 KB
testcase_28 AC 265 ms
215,168 KB
testcase_29 AC 335 ms
242,688 KB
testcase_30 AC 454 ms
244,736 KB
testcase_31 AC 413 ms
244,992 KB
testcase_32 AC 182 ms
154,624 KB
testcase_33 AC 106 ms
104,960 KB
testcase_34 AC 247 ms
199,424 KB
testcase_35 AC 595 ms
244,740 KB
testcase_36 AC 152 ms
135,296 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