結果

問題 No.2142 Segment Zero
ユーザー 👑 tamatotamato
提出日時 2022-12-02 21:31:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 401 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 82,436 KB
実行使用メモリ 225,024 KB
最終ジャッジ日時 2024-04-18 05:15:29
合計ジャッジ時間 7,351 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,224 KB
testcase_01 AC 244 ms
224,640 KB
testcase_02 AC 36 ms
52,096 KB
testcase_03 AC 231 ms
224,896 KB
testcase_04 AC 228 ms
224,256 KB
testcase_05 AC 230 ms
224,384 KB
testcase_06 AC 36 ms
52,352 KB
testcase_07 AC 238 ms
224,384 KB
testcase_08 AC 250 ms
225,024 KB
testcase_09 AC 239 ms
224,256 KB
testcase_10 AC 238 ms
224,256 KB
testcase_11 AC 249 ms
224,640 KB
testcase_12 AC 235 ms
224,256 KB
testcase_13 AC 243 ms
224,640 KB
testcase_14 AC 230 ms
224,640 KB
testcase_15 AC 239 ms
224,640 KB
testcase_16 AC 231 ms
224,384 KB
testcase_17 AC 195 ms
193,280 KB
testcase_18 AC 79 ms
94,080 KB
testcase_19 AC 73 ms
90,368 KB
testcase_20 AC 141 ms
148,864 KB
testcase_21 AC 162 ms
159,360 KB
testcase_22 AC 178 ms
180,352 KB
testcase_23 AC 77 ms
90,624 KB
testcase_24 AC 97 ms
107,648 KB
testcase_25 AC 112 ms
124,416 KB
testcase_26 AC 179 ms
179,712 KB
testcase_27 AC 196 ms
180,344 KB
testcase_28 AC 127 ms
131,712 KB
testcase_29 AC 141 ms
148,864 KB
testcase_30 AC 176 ms
179,456 KB
testcase_31 AC 176 ms
171,648 KB
testcase_32 AC 93 ms
102,376 KB
testcase_33 AC 63 ms
79,360 KB
testcase_34 AC 111 ms
124,540 KB
testcase_35 AC 223 ms
224,000 KB
testcase_36 AC 80 ms
93,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def main():
    import sys
    input = sys.stdin.readline
    
    N, K = map(int, input().split())
    
    ans = 2
    R = {0}
    r = 0
    for i in range(N, 0, -1):
        r += i
        R.add(r)
    l = 0
    if K in R:
        ans = 1
    for i in range(1, N+1):
        l += i
        if K - l in R:
            ans = 1
    print(ans)


if __name__ == '__main__':
    main()
0