結果

問題 No.2142 Segment Zero
ユーザー 👑 KazunKazun
提出日時 2022-12-02 21:36:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 295 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 224,640 KB
最終ジャッジ日時 2024-04-18 05:21:46
合計ジャッジ時間 6,404 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
51,456 KB
testcase_01 AC 237 ms
224,128 KB
testcase_02 AC 39 ms
51,328 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 226 ms
223,872 KB
testcase_05 AC 222 ms
223,872 KB
testcase_06 AC 37 ms
52,096 KB
testcase_07 AC 87 ms
102,656 KB
testcase_08 AC 223 ms
223,616 KB
testcase_09 AC 147 ms
159,488 KB
testcase_10 AC 219 ms
223,872 KB
testcase_11 AC 223 ms
224,640 KB
testcase_12 AC 220 ms
223,872 KB
testcase_13 AC 221 ms
224,256 KB
testcase_14 AC 223 ms
223,872 KB
testcase_15 AC 213 ms
223,872 KB
testcase_16 AC 217 ms
223,872 KB
testcase_17 AC 189 ms
193,024 KB
testcase_18 AC 45 ms
62,592 KB
testcase_19 AC 63 ms
78,976 KB
testcase_20 AC 138 ms
148,352 KB
testcase_21 AC 112 ms
130,560 KB
testcase_22 AC 168 ms
179,456 KB
testcase_23 AC 75 ms
89,216 KB
testcase_24 AC 91 ms
107,008 KB
testcase_25 AC 75 ms
89,984 KB
testcase_26 AC 126 ms
139,264 KB
testcase_27 AC 89 ms
102,656 KB
testcase_28 AC 119 ms
131,584 KB
testcase_29 AC 137 ms
147,968 KB
testcase_30 AC 169 ms
179,072 KB
testcase_31 AC 44 ms
62,208 KB
testcase_32 AC 84 ms
97,328 KB
testcase_33 AC 60 ms
76,160 KB
testcase_34 AC 83 ms
97,792 KB
testcase_35 AC 213 ms
223,488 KB
testcase_36 AC 77 ms
93,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    N,K=map(int,input().split())

    M=N*(N+1)//2

    if K==M:
        return 0

    S={0}; s=0
    for a in range(1,N+1):
        s+=a
        if s-(M-K) in S:
            return 1
        S.add(s)

    return 2
#==================================================
print(solve())
0