結果

問題 No.2142 Segment Zero
ユーザー 👑 NachiaNachia
提出日時 2024-04-21 16:43:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 301 ms / 2,000 ms
コード長 505 bytes
コンパイル時間 868 ms
コンパイル使用メモリ 86,492 KB
実行使用メモリ 57,984 KB
最終ジャッジ日時 2024-04-21 16:44:01
合計ジャッジ時間 8,169 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 202 ms
57,956 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 283 ms
57,984 KB
testcase_04 AC 275 ms
57,812 KB
testcase_05 AC 301 ms
57,812 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 265 ms
57,856 KB
testcase_08 AC 199 ms
57,944 KB
testcase_09 AC 234 ms
57,856 KB
testcase_10 AC 201 ms
57,916 KB
testcase_11 AC 229 ms
57,856 KB
testcase_12 AC 203 ms
57,924 KB
testcase_13 AC 202 ms
57,728 KB
testcase_14 AC 220 ms
57,748 KB
testcase_15 AC 202 ms
57,860 KB
testcase_16 AC 203 ms
57,856 KB
testcase_17 AC 178 ms
48,600 KB
testcase_18 AC 59 ms
16,000 KB
testcase_19 AC 47 ms
14,464 KB
testcase_20 AC 105 ms
33,536 KB
testcase_21 AC 154 ms
37,280 KB
testcase_22 AC 146 ms
42,976 KB
testcase_23 AC 37 ms
14,336 KB
testcase_24 AC 59 ms
20,864 KB
testcase_25 AC 89 ms
23,944 KB
testcase_26 AC 160 ms
41,600 KB
testcase_27 AC 201 ms
43,392 KB
testcase_28 AC 88 ms
28,672 KB
testcase_29 AC 105 ms
33,152 KB
testcase_30 AC 145 ms
42,360 KB
testcase_31 AC 199 ms
41,192 KB
testcase_32 AC 67 ms
19,328 KB
testcase_33 AC 24 ms
10,368 KB
testcase_34 AC 92 ms
24,448 KB
testcase_35 AC 229 ms
56,448 KB
testcase_36 AC 42 ms
15,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <utility>

using namespace std;
using i64 = long long;
#define rep(i,n) for(int i=0; i<(int)(n); i++)

int main(){
    ios::sync_with_stdio(false); cin.tie(nullptr);
    i64 N, K; cin >> N >> K;
    vector<i64> S(N+1);
    rep(i,N) S[i+1] = S[i] + (i+1);
    set<i64> Q(S.begin(), S.end());
    int ans = 2;
    rep(i,N+1) if(Q.count(K - (S[N] - S[i]))) ans = 1;
    cout << ans << '\n';
    return 0;
}
0