結果

問題 No.2142 Segment Zero
ユーザー tree_splaytree_splay
提出日時 2022-12-02 21:46:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 532 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 2,270 ms
コンパイル使用メモリ 198,684 KB
実行使用メモリ 50,432 KB
最終ジャッジ日時 2024-04-18 05:31:50
合計ジャッジ時間 11,022 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 399 ms
50,176 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 532 ms
50,304 KB
testcase_05 AC 522 ms
50,176 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 101 ms
17,152 KB
testcase_08 AC 398 ms
50,432 KB
testcase_09 AC 244 ms
33,152 KB
testcase_10 AC 402 ms
50,304 KB
testcase_11 AC 405 ms
50,304 KB
testcase_12 AC 401 ms
50,432 KB
testcase_13 AC 400 ms
50,432 KB
testcase_14 AC 400 ms
50,176 KB
testcase_15 AC 400 ms
50,304 KB
testcase_16 AC 403 ms
50,304 KB
testcase_17 AC 337 ms
42,240 KB
testcase_18 AC 10 ms
6,940 KB
testcase_19 AC 49 ms
10,112 KB
testcase_20 AC 207 ms
29,440 KB
testcase_21 AC 172 ms
23,552 KB
testcase_22 AC 280 ms
37,760 KB
testcase_23 AC 66 ms
12,928 KB
testcase_24 AC 111 ms
18,432 KB
testcase_25 AC 62 ms
12,288 KB
testcase_26 AC 196 ms
28,032 KB
testcase_27 AC 105 ms
17,152 KB
testcase_28 AC 169 ms
25,344 KB
testcase_29 AC 205 ms
29,312 KB
testcase_30 AC 285 ms
36,992 KB
testcase_31 AC 9 ms
6,944 KB
testcase_32 AC 88 ms
14,976 KB
testcase_33 AC 39 ms
9,344 KB
testcase_34 AC 87 ms
15,232 KB
testcase_35 AC 392 ms
49,152 KB
testcase_36 AC 76 ms
13,824 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