結果

問題 No.2142 Segment Zero
ユーザー roaris
提出日時 2022-12-02 22:16:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 241 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 226,816 KB
最終ジャッジ日時 2024-10-09 23:46:12
合計ジャッジ時間 7,562 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N, K = map(int, input().split())
s = {0}
acc = 0

for i in range(1, N+1):
    acc += i
    
    if acc-(N*(N+1)//2-K) in s:
        exit(print(1))
    
    s.add(acc)

print(2)
0