結果

問題 No.2142 Segment Zero
ユーザー tree_splaytree_splay
提出日時 2022-12-02 21:46:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 524 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 2,433 ms
コンパイル使用メモリ 203,640 KB
実行使用メモリ 50,392 KB
最終ジャッジ日時 2023-07-31 04:37:13
合計ジャッジ時間 11,406 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 406 ms
50,248 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 524 ms
50,244 KB
testcase_05 AC 517 ms
50,392 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 102 ms
17,072 KB
testcase_08 AC 396 ms
50,232 KB
testcase_09 AC 246 ms
33,080 KB
testcase_10 AC 404 ms
50,188 KB
testcase_11 AC 407 ms
50,200 KB
testcase_12 AC 406 ms
50,224 KB
testcase_13 AC 401 ms
50,188 KB
testcase_14 AC 408 ms
50,244 KB
testcase_15 AC 404 ms
50,228 KB
testcase_16 AC 410 ms
50,236 KB
testcase_17 AC 331 ms
42,280 KB
testcase_18 AC 9 ms
4,980 KB
testcase_19 AC 48 ms
10,016 KB
testcase_20 AC 210 ms
29,392 KB
testcase_21 AC 172 ms
23,364 KB
testcase_22 AC 282 ms
37,452 KB
testcase_23 AC 67 ms
12,792 KB
testcase_24 AC 110 ms
18,356 KB
testcase_25 AC 61 ms
12,292 KB
testcase_26 AC 199 ms
28,032 KB
testcase_27 AC 106 ms
17,132 KB
testcase_28 AC 172 ms
25,096 KB
testcase_29 AC 210 ms
29,068 KB
testcase_30 AC 279 ms
36,872 KB
testcase_31 AC 8 ms
4,740 KB
testcase_32 AC 85 ms
14,676 KB
testcase_33 AC 39 ms
9,244 KB
testcase_34 AC 86 ms
15,120 KB
testcase_35 AC 393 ms
49,156 KB
testcase_36 AC 74 ms
13,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define INF 1234567890
#define ll long long

ll N, K;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	cin.exceptions(ios::badbit | ios::failbit);
	cin >> N >> K;
	K = N*(N+1)/2 - K; // remove sum = K, minimize remove count
	assert(K > 0);

	set<ll> s;
	for(ll i=1; i<=N; i++)
	{
		s.insert((i-1)*i/2);
		if (s.find(i*(i+1)/2 - K) != s.end())
		{
			cout << "1\n";
			return 0;
		}
	}
	cout << "2\n";
	return 0;
}
0