結果

問題 No.2142 Segment Zero
ユーザー sepa38sepa38
提出日時 2022-12-02 21:46:26
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 76,388 KB
最終ジャッジ日時 2023-07-31 04:39:47
合計ジャッジ時間 5,147 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,540 KB
testcase_01 AC 79 ms
75,596 KB
testcase_02 AC 70 ms
71,232 KB
testcase_03 AC 70 ms
71,272 KB
testcase_04 AC 95 ms
75,976 KB
testcase_05 AC 95 ms
75,988 KB
testcase_06 AC 69 ms
71,420 KB
testcase_07 AC 81 ms
76,004 KB
testcase_08 AC 91 ms
76,128 KB
testcase_09 AC 85 ms
76,204 KB
testcase_10 AC 90 ms
76,136 KB
testcase_11 AC 89 ms
76,192 KB
testcase_12 AC 89 ms
76,136 KB
testcase_13 AC 92 ms
76,068 KB
testcase_14 AC 91 ms
76,080 KB
testcase_15 AC 90 ms
76,108 KB
testcase_16 AC 89 ms
76,080 KB
testcase_17 AC 89 ms
76,208 KB
testcase_18 AC 74 ms
75,540 KB
testcase_19 AC 79 ms
76,064 KB
testcase_20 AC 88 ms
76,244 KB
testcase_21 AC 87 ms
75,920 KB
testcase_22 AC 81 ms
76,008 KB
testcase_23 AC 76 ms
75,960 KB
testcase_24 AC 77 ms
75,936 KB
testcase_25 AC 78 ms
75,836 KB
testcase_26 AC 85 ms
76,080 KB
testcase_27 AC 81 ms
75,972 KB
testcase_28 AC 87 ms
76,212 KB
testcase_29 AC 85 ms
76,388 KB
testcase_30 AC 88 ms
76,132 KB
testcase_31 AC 76 ms
76,016 KB
testcase_32 AC 79 ms
75,876 KB
testcase_33 AC 73 ms
75,756 KB
testcase_34 AC 78 ms
75,936 KB
testcase_35 AC 90 ms
76,272 KB
testcase_36 AC 81 ms
75,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k = map(int, input().split())
r = 1
s = n * (n + 1) // 2
for l in range(1, n+1):
  while r <= n:
    if s - r * (r + 1) // 2 + l * (l - 1) // 2 == k:
      print(1)
      exit()
    elif s - r * (r + 1) // 2 + l * (l - 1) // 2 < k:
      r -= 1
      break
    r += 1
print(2)
0