結果

問題 No.2142 Segment Zero
ユーザー 👑 NachiaNachia
提出日時 2022-12-02 21:40:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 238 ms / 2,000 ms
コード長 712 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 85,212 KB
実行使用メモリ 57,904 KB
最終ジャッジ日時 2024-04-27 04:18:21
合計ジャッジ時間 6,236 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 176 ms
57,904 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 238 ms
57,880 KB
testcase_04 AC 226 ms
57,776 KB
testcase_05 AC 228 ms
57,872 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 220 ms
57,796 KB
testcase_08 AC 172 ms
57,832 KB
testcase_09 AC 197 ms
57,732 KB
testcase_10 AC 172 ms
57,704 KB
testcase_11 AC 176 ms
57,852 KB
testcase_12 AC 176 ms
57,792 KB
testcase_13 AC 171 ms
57,860 KB
testcase_14 AC 171 ms
57,768 KB
testcase_15 AC 169 ms
57,852 KB
testcase_16 AC 185 ms
57,864 KB
testcase_17 AC 149 ms
48,644 KB
testcase_18 AC 50 ms
16,000 KB
testcase_19 AC 37 ms
14,464 KB
testcase_20 AC 90 ms
33,480 KB
testcase_21 AC 125 ms
37,196 KB
testcase_22 AC 128 ms
43,000 KB
testcase_23 AC 29 ms
14,208 KB
testcase_24 AC 47 ms
20,864 KB
testcase_25 AC 73 ms
23,936 KB
testcase_26 AC 140 ms
41,532 KB
testcase_27 AC 163 ms
43,520 KB
testcase_28 AC 77 ms
28,568 KB
testcase_29 AC 90 ms
33,312 KB
testcase_30 AC 126 ms
42,200 KB
testcase_31 AC 160 ms
41,184 KB
testcase_32 AC 49 ms
19,200 KB
testcase_33 AC 16 ms
10,496 KB
testcase_34 AC 73 ms
24,704 KB
testcase_35 AC 170 ms
56,484 KB
testcase_36 AC 38 ms
15,232 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