結果

問題 No.2142 Segment Zero
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2023-01-20 12:27:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 564 ms
コンパイル使用メモリ 86,504 KB
実行使用メモリ 161,068 KB
最終ジャッジ日時 2023-09-05 06:21:16
合計ジャッジ時間 11,247 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 111 ms
72,736 KB
testcase_01 AC 198 ms
159,960 KB
testcase_02 AC 108 ms
72,468 KB
testcase_03 AC 168 ms
159,892 KB
testcase_04 AC 239 ms
159,648 KB
testcase_05 AC 205 ms
161,068 KB
testcase_06 AC 108 ms
72,536 KB
testcase_07 AC 188 ms
160,340 KB
testcase_08 AC 284 ms
159,968 KB
testcase_09 AC 177 ms
160,264 KB
testcase_10 AC 325 ms
159,824 KB
testcase_11 AC 368 ms
159,876 KB
testcase_12 AC 316 ms
159,816 KB
testcase_13 AC 314 ms
160,188 KB
testcase_14 AC 323 ms
159,816 KB
testcase_15 AC 319 ms
159,728 KB
testcase_16 AC 328 ms
159,736 KB
testcase_17 AC 323 ms
150,928 KB
testcase_18 AC 135 ms
96,488 KB
testcase_19 AC 149 ms
94,200 KB
testcase_20 AC 254 ms
126,904 KB
testcase_21 WA -
testcase_22 AC 270 ms
142,808 KB
testcase_23 AC 132 ms
94,120 KB
testcase_24 AC 143 ms
104,612 KB
testcase_25 AC 150 ms
112,028 KB
testcase_26 AC 173 ms
140,520 KB
testcase_27 AC 186 ms
141,348 KB
testcase_28 AC 234 ms
116,792 KB
testcase_29 AC 252 ms
127,088 KB
testcase_30 AC 268 ms
141,040 KB
testcase_31 AC 161 ms
140,576 KB
testcase_32 AC 159 ms
101,940 KB
testcase_33 AC 123 ms
88,524 KB
testcase_34 AC 146 ms
111,748 KB
testcase_35 AC 310 ms
159,680 KB
testcase_36 AC 157 ms
96,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *
from itertools import *
from functools import *
from heapq import *
import math,sys
input = sys.stdin.readline

N,K = map(int,input().split())
A = [i+1 for i in range(N)]
S = list(accumulate([0]+A))
if S[-1]==K:
    print(0)
    exit()
SN = N*(N+1)//2
for i in range(N):
    
    if S[-1]-S[i]<K:
        break
    
    y = N
    x = i
    while y-x>1:
        mid = (y+x)//2
        
        if S[mid]-S[i]<SN-K:
            x = mid
        else:
            y = mid
    if S[y]-S[i]==SN-K:
        print(1)
        exit()
print(2)
0