結果

問題 No.2142 Segment Zero
ユーザー 沙耶花沙耶花
提出日時 2022-12-02 21:25:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 533 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 4,315 ms
コンパイル使用メモリ 264,276 KB
実行使用メモリ 50,312 KB
最終ジャッジ日時 2023-07-31 04:09:39
合計ジャッジ時間 14,056 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 416 ms
50,264 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 533 ms
50,300 KB
testcase_05 AC 523 ms
50,256 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 107 ms
17,292 KB
testcase_08 AC 415 ms
50,284 KB
testcase_09 AC 247 ms
33,040 KB
testcase_10 AC 414 ms
50,240 KB
testcase_11 AC 409 ms
50,224 KB
testcase_12 AC 415 ms
50,268 KB
testcase_13 AC 413 ms
50,220 KB
testcase_14 AC 412 ms
50,296 KB
testcase_15 AC 418 ms
50,312 KB
testcase_16 AC 412 ms
50,260 KB
testcase_17 AC 335 ms
42,308 KB
testcase_18 AC 10 ms
5,276 KB
testcase_19 AC 50 ms
10,316 KB
testcase_20 AC 215 ms
29,340 KB
testcase_21 AC 177 ms
23,404 KB
testcase_22 AC 289 ms
37,524 KB
testcase_23 AC 69 ms
12,872 KB
testcase_24 AC 115 ms
18,496 KB
testcase_25 AC 64 ms
12,228 KB
testcase_26 AC 204 ms
28,116 KB
testcase_27 AC 110 ms
17,136 KB
testcase_28 AC 177 ms
25,180 KB
testcase_29 AC 211 ms
29,264 KB
testcase_30 AC 286 ms
36,896 KB
testcase_31 AC 9 ms
5,040 KB
testcase_32 AC 90 ms
14,844 KB
testcase_33 AC 40 ms
9,268 KB
testcase_34 AC 88 ms
15,172 KB
testcase_35 AC 403 ms
49,104 KB
testcase_36 AC 80 ms
13,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001



int main(){
	
	long long n,k;
	cin>>n>>k;
	
	k = (n*(n+1))/2 - k;
	
	set<long long> S;
	S.insert(0);
	long long cur = 0;
	for(long long i=1;i<=n;i++){
		cur += i;
		if(S.count(cur-k)){
			cout<<1<<endl;
			return 0;
		}
		S.insert(cur);
	}
	
	cout<<2<<endl;
	
	return 0;
}
0