結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 326 ms
50,176 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 476 ms
50,432 KB
testcase_05 AC 475 ms
50,176 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 353 ms
50,176 KB
testcase_08 AC 405 ms
50,304 KB
testcase_09 AC 332 ms
50,304 KB
testcase_10 AC 404 ms
50,432 KB
testcase_11 AC 403 ms
50,432 KB
testcase_12 AC 406 ms
50,304 KB
testcase_13 AC 404 ms
50,432 KB
testcase_14 AC 406 ms
50,304 KB
testcase_15 AC 411 ms
50,304 KB
testcase_16 AC 409 ms
50,176 KB
testcase_17 AC 333 ms
42,240 KB
testcase_18 AC 70 ms
14,336 KB
testcase_19 AC 68 ms
13,184 KB
testcase_20 AC 210 ms
29,440 KB
testcase_21 AC 200 ms
32,640 KB
testcase_22 AC 287 ms
37,760 KB
testcase_23 AC 58 ms
12,800 KB
testcase_24 AC 96 ms
18,560 KB
testcase_25 AC 127 ms
21,248 KB
testcase_26 AC 239 ms
36,352 KB
testcase_27 AC 247 ms
38,016 KB
testcase_28 AC 175 ms
25,088 KB
testcase_29 AC 208 ms
29,184 KB
testcase_30 AC 282 ms
36,992 KB
testcase_31 AC 288 ms
35,968 KB
testcase_32 AC 93 ms
17,152 KB
testcase_33 AC 36 ms
9,856 KB
testcase_34 AC 117 ms
21,760 KB
testcase_35 AC 394 ms
49,152 KB
testcase_36 AC 80 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(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