結果

問題 No.2142 Segment Zero
ユーザー otoshigootoshigo
提出日時 2022-12-02 21:32:13
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 816 bytes
コンパイル時間 2,345 ms
コンパイル使用メモリ 200,268 KB
実行使用メモリ 50,432 KB
最終ジャッジ日時 2024-04-18 05:16:25
合計ジャッジ時間 11,405 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 290 ms
50,304 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 439 ms
50,176 KB
testcase_05 AC 433 ms
50,176 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 308 ms
50,304 KB
testcase_08 AC 367 ms
50,176 KB
testcase_09 AC 308 ms
50,432 KB
testcase_10 AC 370 ms
50,304 KB
testcase_11 AC 358 ms
50,304 KB
testcase_12 AC 364 ms
50,304 KB
testcase_13 AC 372 ms
50,176 KB
testcase_14 AC 371 ms
50,304 KB
testcase_15 AC 379 ms
50,432 KB
testcase_16 AC 364 ms
50,432 KB
testcase_17 AC 303 ms
42,240 KB
testcase_18 AC 66 ms
14,336 KB
testcase_19 AC 60 ms
13,184 KB
testcase_20 AC 194 ms
29,312 KB
testcase_21 AC 191 ms
32,640 KB
testcase_22 AC 265 ms
37,504 KB
testcase_23 AC 60 ms
12,800 KB
testcase_24 AC 98 ms
18,688 KB
testcase_25 AC 125 ms
21,248 KB
testcase_26 AC 220 ms
36,480 KB
testcase_27 AC 226 ms
38,016 KB
testcase_28 AC 158 ms
25,216 KB
testcase_29 AC 205 ms
29,056 KB
testcase_30 AC 256 ms
36,992 KB
testcase_31 AC 252 ms
35,968 KB
testcase_32 AC 81 ms
17,024 KB
testcase_33 AC 31 ms
9,856 KB
testcase_34 AC 104 ms
21,632 KB
testcase_35 AC 355 ms
49,152 KB
testcase_36 AC 69 ms
13,824 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int n;
ll k;
int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cin>>n>>k;
    set<ll>se;
    for(ll i=1;i<=n;i++)se.insert(i*(i+1)/2);
    if(k==0||se.count(k))cout<<1<<"\n";
    else{
        ll m=0;
        for(ll i=n;i>=1;i--){
            m+=i;
            if(se.count(k-m)){
                cout<<1<<"\n";
                return 0;
            }
        }
        cout<<2<<"\n";
    }
}
0