結果

問題 No.2142 Segment Zero
ユーザー otoshigootoshigo
提出日時 2022-12-02 21:33:52
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 485 ms / 2,000 ms
コード長 810 bytes
コンパイル時間 2,064 ms
コンパイル使用メモリ 199,220 KB
実行使用メモリ 50,432 KB
最終ジャッジ日時 2024-04-18 05:18:45
合計ジャッジ時間 12,440 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 331 ms
50,432 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 485 ms
50,304 KB
testcase_04 AC 480 ms
50,432 KB
testcase_05 AC 480 ms
50,176 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 342 ms
50,176 KB
testcase_08 AC 406 ms
50,176 KB
testcase_09 AC 332 ms
50,304 KB
testcase_10 AC 409 ms
50,304 KB
testcase_11 AC 411 ms
50,304 KB
testcase_12 AC 404 ms
50,304 KB
testcase_13 AC 402 ms
50,176 KB
testcase_14 AC 405 ms
50,432 KB
testcase_15 AC 409 ms
50,304 KB
testcase_16 AC 405 ms
50,304 KB
testcase_17 AC 334 ms
42,240 KB
testcase_18 AC 71 ms
14,464 KB
testcase_19 AC 68 ms
13,056 KB
testcase_20 AC 213 ms
29,568 KB
testcase_21 AC 201 ms
32,640 KB
testcase_22 AC 288 ms
37,632 KB
testcase_23 AC 57 ms
12,800 KB
testcase_24 AC 96 ms
18,560 KB
testcase_25 AC 127 ms
21,248 KB
testcase_26 AC 237 ms
36,352 KB
testcase_27 AC 251 ms
37,888 KB
testcase_28 AC 177 ms
25,216 KB
testcase_29 AC 210 ms
29,312 KB
testcase_30 AC 284 ms
36,992 KB
testcase_31 AC 286 ms
35,968 KB
testcase_32 AC 95 ms
17,024 KB
testcase_33 AC 36 ms
9,728 KB
testcase_34 AC 118 ms
21,760 KB
testcase_35 AC 393 ms
49,152 KB
testcase_36 AC 78 ms
13,952 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=0;i<=n;i++)se.insert(i*(i+1)/2);
    if(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