結果

問題 No.2142 Segment Zero
ユーザー WangzyyWangzyy
提出日時 2023-04-27 16:29:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,004 bytes
コンパイル時間 2,159 ms
コンパイル使用メモリ 191,508 KB
実行使用メモリ 136,216 KB
最終ジャッジ日時 2024-04-28 08:27:03
合計ジャッジ時間 20,882 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
11,188 KB
testcase_01 AC 932 ms
136,004 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 756 ms
136,008 KB
testcase_05 AC 746 ms
136,012 KB
testcase_06 AC 4 ms
11,120 KB
testcase_07 AC 240 ms
47,680 KB
testcase_08 AC 930 ms
135,944 KB
testcase_09 AC 550 ms
90,204 KB
testcase_10 AC 917 ms
135,948 KB
testcase_11 AC 917 ms
136,052 KB
testcase_12 AC 912 ms
136,020 KB
testcase_13 AC 916 ms
135,916 KB
testcase_14 AC 922 ms
136,024 KB
testcase_15 AC 896 ms
136,012 KB
testcase_16 AC 925 ms
135,956 KB
testcase_17 AC 741 ms
114,928 KB
testcase_18 AC 27 ms
15,440 KB
testcase_19 AC 109 ms
28,924 KB
testcase_20 AC 481 ms
80,336 KB
testcase_21 AC 348 ms
64,388 KB
testcase_22 AC 643 ms
102,028 KB
testcase_23 AC 163 ms
36,184 KB
testcase_24 AC 267 ms
51,084 KB
testcase_25 AC 149 ms
34,692 KB
testcase_26 AC 451 ms
76,844 KB
testcase_27 AC 232 ms
47,836 KB
testcase_28 AC 393 ms
69,004 KB
testcase_29 AC 479 ms
79,776 KB
testcase_30 AC 632 ms
100,296 KB
testcase_31 AC 24 ms
14,808 KB
testcase_32 AC 188 ms
41,332 KB
testcase_33 AC 98 ms
26,688 KB
testcase_34 AC 203 ms
42,540 KB
testcase_35 AC 862 ms
132,848 KB
testcase_36 AC 181 ms
38,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>

#define ios_close std::ios::sync_with_stdio(false), std::cin.tie(nullptr), std::cout.tie(nullptr)

using ll = long long;
using ull = unsigned long long;
using i128 = __int128;
#define Pi  acos(-1.0);
#define PINF 0x3f3f3f3f
#define NINF -0x3f3f3f3f

void solve(){
    std::vector<ll> pre(1000010);
    int n;
    ll k;
    scanf("%d %lld", &n, &k);
    for(int i = 1; i <= n; i ++ ){
        pre[i] = pre[i - 1] + i;
    }
    if(pre[n] == k){
        printf("0");
        return ;
    }
    std::map<ll, bool> map;
    ll t = k - pre[n];
    for(int i = 1; i <= n; i ++ ){
        if(map[t + pre[i]]){
            printf("1");
            return ;
        }
        map[pre[i]] = true;
    }
    printf("2");
}

int main(){
#if 0
    ios_close;
#endif

#if 0
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
#endif
    int T = 1;
#if 0
    std::cin >> T;
#endif
    while(T -- ){
        solve();
    }
    return 0;
}
0