結果

問題 No.2142 Segment Zero
ユーザー shobonvipshobonvip
提出日時 2022-12-02 21:46:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 758 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 254,368 KB
最終ジャッジ日時 2024-04-18 05:35:42
合計ジャッジ時間 18,824 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
53,760 KB
testcase_01 AC 758 ms
253,908 KB
testcase_02 AC 47 ms
53,504 KB
testcase_03 AC 738 ms
253,848 KB
testcase_04 AC 739 ms
254,112 KB
testcase_05 AC 741 ms
253,760 KB
testcase_06 AC 47 ms
53,632 KB
testcase_07 AC 731 ms
254,104 KB
testcase_08 AC 703 ms
253,736 KB
testcase_09 AC 710 ms
253,832 KB
testcase_10 AC 707 ms
253,728 KB
testcase_11 AC 697 ms
253,980 KB
testcase_12 AC 709 ms
254,000 KB
testcase_13 AC 717 ms
254,028 KB
testcase_14 AC 708 ms
253,916 KB
testcase_15 AC 709 ms
254,368 KB
testcase_16 AC 709 ms
254,100 KB
testcase_17 AC 603 ms
253,200 KB
testcase_18 AC 156 ms
139,136 KB
testcase_19 AC 153 ms
131,328 KB
testcase_20 AC 413 ms
247,424 KB
testcase_21 AC 443 ms
250,624 KB
testcase_22 AC 536 ms
252,888 KB
testcase_23 AC 148 ms
130,944 KB
testcase_24 AC 242 ms
169,344 KB
testcase_25 AC 272 ms
190,208 KB
testcase_26 AC 528 ms
252,032 KB
testcase_27 AC 548 ms
254,336 KB
testcase_28 AC 305 ms
219,008 KB
testcase_29 AC 390 ms
247,296 KB
testcase_30 AC 530 ms
252,800 KB
testcase_31 AC 469 ms
253,056 KB
testcase_32 AC 195 ms
158,208 KB
testcase_33 AC 118 ms
108,800 KB
testcase_34 AC 293 ms
203,776 KB
testcase_35 AC 673 ms
253,720 KB
testcase_36 AC 154 ms
138,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n,k = map(int,input().split())
k = n*(n+1)//2 - k
d = defaultdict(int)
for i in range(1, n+1):
	d[i*i - i] = i
# r(r+1) - l(l-1) = 2k
# (r^2+r) - (l^2-l) = 2k
# r^2+r = 2k + (l^2-l)

ans = 2
for i in range(1, n+1):
	t = i*i + i - 2*k
	if 0 < d[t] <= i:
		ans = 1

print(ans)
0