結果

問題 No.2142 Segment Zero
ユーザー 沙耶花沙耶花
提出日時 2022-12-02 21:25:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 548 ms / 2,000 ms
コード長 525 bytes
コンパイル時間 4,457 ms
コンパイル使用メモリ 257,376 KB
実行使用メモリ 50,560 KB
最終ジャッジ日時 2024-04-18 05:10:38
合計ジャッジ時間 13,875 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 430 ms
50,304 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 548 ms
50,560 KB
testcase_05 AC 532 ms
50,432 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 109 ms
17,152 KB
testcase_08 AC 420 ms
50,432 KB
testcase_09 AC 252 ms
33,152 KB
testcase_10 AC 428 ms
50,304 KB
testcase_11 AC 418 ms
50,304 KB
testcase_12 AC 418 ms
50,304 KB
testcase_13 AC 424 ms
50,432 KB
testcase_14 AC 416 ms
50,304 KB
testcase_15 AC 416 ms
50,432 KB
testcase_16 AC 415 ms
50,304 KB
testcase_17 AC 338 ms
42,496 KB
testcase_18 AC 11 ms
5,376 KB
testcase_19 AC 51 ms
10,240 KB
testcase_20 AC 217 ms
29,568 KB
testcase_21 AC 180 ms
23,424 KB
testcase_22 AC 293 ms
37,632 KB
testcase_23 AC 70 ms
12,928 KB
testcase_24 AC 116 ms
18,560 KB
testcase_25 AC 64 ms
12,288 KB
testcase_26 AC 204 ms
28,288 KB
testcase_27 AC 112 ms
17,280 KB
testcase_28 AC 179 ms
25,216 KB
testcase_29 AC 218 ms
29,184 KB
testcase_30 AC 286 ms
36,864 KB
testcase_31 AC 9 ms
5,376 KB
testcase_32 AC 92 ms
14,848 KB
testcase_33 AC 41 ms
9,472 KB
testcase_34 AC 91 ms
15,232 KB
testcase_35 AC 405 ms
49,280 KB
testcase_36 AC 80 ms
14,080 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