結果

問題 No.2142 Segment Zero
ユーザー ぷらぷら
提出日時 2022-12-02 21:27:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 73 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 2,081 ms
コンパイル使用メモリ 201,968 KB
実行使用メモリ 10,832 KB
最終ジャッジ日時 2023-07-31 04:11:24
合計ジャッジ時間 4,025 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 6 ms
10,752 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 6 ms
10,788 KB
testcase_04 AC 73 ms
10,756 KB
testcase_05 AC 71 ms
10,736 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 8 ms
10,712 KB
testcase_08 AC 31 ms
10,800 KB
testcase_09 AC 7 ms
10,712 KB
testcase_10 AC 32 ms
10,768 KB
testcase_11 AC 32 ms
10,744 KB
testcase_12 AC 31 ms
10,776 KB
testcase_13 AC 31 ms
10,692 KB
testcase_14 AC 32 ms
10,736 KB
testcase_15 AC 32 ms
10,832 KB
testcase_16 AC 30 ms
10,696 KB
testcase_17 AC 28 ms
9,460 KB
testcase_18 AC 3 ms
4,828 KB
testcase_19 AC 7 ms
4,684 KB
testcase_20 AC 18 ms
7,552 KB
testcase_21 AC 22 ms
7,924 KB
testcase_22 AC 27 ms
8,772 KB
testcase_23 AC 3 ms
4,716 KB
testcase_24 AC 4 ms
5,908 KB
testcase_25 AC 5 ms
5,956 KB
testcase_26 AC 7 ms
8,484 KB
testcase_27 AC 11 ms
8,808 KB
testcase_28 AC 14 ms
6,628 KB
testcase_29 AC 19 ms
7,556 KB
testcase_30 AC 24 ms
8,732 KB
testcase_31 AC 5 ms
8,548 KB
testcase_32 AC 10 ms
5,496 KB
testcase_33 AC 3 ms
4,380 KB
testcase_34 AC 5 ms
6,304 KB
testcase_35 AC 31 ms
10,804 KB
testcase_36 AC 10 ms
4,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    long long K;
    cin >> N >> K;
    vector<long long>sum(N+1);
    for(int i = 0; i < N; i++) {
        sum[i+1] = sum[i]+i+1;
    }
    for(int i = 0; i < N; i++) {
        int it = lower_bound(sum.begin(),sum.end(),sum[i]+(sum[N]-K))-sum.begin();
        if(it <= N && sum[it] == sum[i]+(sum[N]-K)) {
            cout << 1 << endl;
            return 0;
        }
    }
    cout << 2 << endl;
}
0