結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 48 ms
18,836 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 102 ms
18,816 KB
testcase_04 AC 97 ms
18,944 KB
testcase_05 AC 95 ms
18,816 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 89 ms
18,688 KB
testcase_08 AC 51 ms
18,816 KB
testcase_09 AC 71 ms
18,856 KB
testcase_10 AC 48 ms
18,816 KB
testcase_11 AC 48 ms
18,824 KB
testcase_12 AC 47 ms
18,816 KB
testcase_13 AC 48 ms
18,816 KB
testcase_14 AC 48 ms
18,816 KB
testcase_15 AC 49 ms
18,688 KB
testcase_16 AC 49 ms
18,720 KB
testcase_17 AC 42 ms
16,256 KB
testcase_18 AC 24 ms
7,040 KB
testcase_19 AC 17 ms
6,272 KB
testcase_20 AC 27 ms
11,864 KB
testcase_21 AC 50 ms
12,856 KB
testcase_22 AC 39 ms
14,464 KB
testcase_23 AC 11 ms
6,400 KB
testcase_24 AC 17 ms
8,320 KB
testcase_25 AC 32 ms
9,216 KB
testcase_26 AC 45 ms
14,124 KB
testcase_27 AC 64 ms
14,704 KB
testcase_28 AC 25 ms
10,496 KB
testcase_29 AC 29 ms
11,776 KB
testcase_30 AC 37 ms
14,208 KB
testcase_31 AC 72 ms
14,080 KB
testcase_32 AC 21 ms
7,680 KB
testcase_33 AC 8 ms
5,376 KB
testcase_34 AC 28 ms
9,344 KB
testcase_35 AC 47 ms
18,432 KB
testcase_36 AC 13 ms
6,656 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#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);
    vector<i64> Q = S;
    sort(Q.begin(), Q.end());
    int ans = 2;
    rep(i,N+1) if(binary_search(Q.begin(), Q.end(), K - (S[N] - S[i]))) ans = 1;
    cout << ans << '\n';
    return 0;
}
0