結果

問題 No.2142 Segment Zero
ユーザー 👑 NachiaNachia
提出日時 2022-12-02 21:40:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 1,123 ms
コンパイル使用メモリ 84,552 KB
実行使用メモリ 57,904 KB
最終ジャッジ日時 2023-07-31 04:33:09
合計ジャッジ時間 7,841 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 197 ms
57,676 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 267 ms
57,780 KB
testcase_04 AC 266 ms
57,664 KB
testcase_05 AC 263 ms
57,660 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 254 ms
57,712 KB
testcase_08 AC 198 ms
57,732 KB
testcase_09 AC 231 ms
57,904 KB
testcase_10 AC 197 ms
57,716 KB
testcase_11 AC 197 ms
57,824 KB
testcase_12 AC 199 ms
57,712 KB
testcase_13 AC 199 ms
57,804 KB
testcase_14 AC 198 ms
57,816 KB
testcase_15 AC 195 ms
57,748 KB
testcase_16 AC 200 ms
57,660 KB
testcase_17 AC 167 ms
48,704 KB
testcase_18 AC 58 ms
15,680 KB
testcase_19 AC 47 ms
14,400 KB
testcase_20 AC 108 ms
33,312 KB
testcase_21 AC 147 ms
36,984 KB
testcase_22 AC 142 ms
42,816 KB
testcase_23 AC 37 ms
14,056 KB
testcase_24 AC 59 ms
20,736 KB
testcase_25 AC 89 ms
23,760 KB
testcase_26 AC 156 ms
41,480 KB
testcase_27 AC 181 ms
43,264 KB
testcase_28 AC 91 ms
28,244 KB
testcase_29 AC 106 ms
32,984 KB
testcase_30 AC 144 ms
42,052 KB
testcase_31 AC 183 ms
40,820 KB
testcase_32 AC 62 ms
19,152 KB
testcase_33 AC 23 ms
10,488 KB
testcase_34 AC 86 ms
24,384 KB
testcase_35 AC 193 ms
56,412 KB
testcase_36 AC 43 ms
15,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
const i64 INF = 1001001001001001001;

int main(){
    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;
}


struct ios_do_not_sync{
    ios_do_not_sync(){
        std::ios::sync_with_stdio(false);
        std::cin.tie(nullptr);
    }
} ios_do_not_sync_instance;


0