結果

問題 No.2142 Segment Zero
ユーザー ああいい
提出日時 2022-12-04 15:53:58
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 298 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 253 ms
コンパイル使用メモリ 81,868 KB
実行使用メモリ 224,768 KB
最終ジャッジ日時 2024-10-11 18:54:15
合計ジャッジ時間 6,882 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K = map(int,input().split())
import sys

S = N * (N + 1) // 2
L = S - K
s = set()
now = 0
s.add(now)
for i in range(1,N + 1):
    now += i
    if now - L in s:
        print(1)
        exit()
    s.add(now)
print(2)
0