結果

問題 No.2142 Segment Zero
ユーザー MasKoaTSMasKoaTS
提出日時 2022-12-02 22:40:45
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 75,952 KB
最終ジャッジ日時 2023-07-31 06:39:22
合計ジャッジ時間 4,611 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,312 KB
testcase_01 AC 75 ms
75,460 KB
testcase_02 AC 70 ms
71,636 KB
testcase_03 AC 67 ms
71,392 KB
testcase_04 AC 85 ms
75,552 KB
testcase_05 AC 81 ms
75,664 KB
testcase_06 AC 69 ms
71,184 KB
testcase_07 AC 74 ms
75,548 KB
testcase_08 AC 75 ms
75,636 KB
testcase_09 AC 75 ms
75,680 KB
testcase_10 AC 76 ms
75,644 KB
testcase_11 AC 76 ms
75,724 KB
testcase_12 AC 77 ms
75,572 KB
testcase_13 AC 77 ms
75,644 KB
testcase_14 AC 77 ms
75,648 KB
testcase_15 AC 76 ms
75,680 KB
testcase_16 AC 76 ms
75,788 KB
testcase_17 AC 75 ms
75,952 KB
testcase_18 AC 70 ms
75,408 KB
testcase_19 AC 73 ms
75,680 KB
testcase_20 AC 75 ms
75,428 KB
testcase_21 AC 76 ms
75,728 KB
testcase_22 AC 75 ms
75,608 KB
testcase_23 AC 74 ms
75,708 KB
testcase_24 AC 76 ms
75,604 KB
testcase_25 AC 74 ms
75,596 KB
testcase_26 AC 75 ms
75,732 KB
testcase_27 AC 74 ms
75,700 KB
testcase_28 AC 75 ms
75,560 KB
testcase_29 AC 75 ms
75,588 KB
testcase_30 AC 75 ms
75,640 KB
testcase_31 AC 74 ms
75,668 KB
testcase_32 AC 76 ms
75,600 KB
testcase_33 AC 72 ms
75,464 KB
testcase_34 AC 75 ms
75,628 KB
testcase_35 AC 78 ms
75,684 KB
testcase_36 AC 75 ms
75,628 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

n, m = map(int, input().split())

t = n * (n + 1) // 2 - m
if(t == 0):
	print(0)
	exit(0)

l = r = 1
s = 0
while(True):
	if(s == t):
		print(1)
		exit(0)
	elif(s < t):
		if(r > n):
			print(2)
			exit(0)
		s += r
		r += 1
	else:
		s -= l
		l += 1
0