結果

問題 No.944 煎っぞ!
ユーザー YamaKasaYamaKasa
提出日時 2019-12-24 00:25:31
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 855 bytes
コンパイル時間 1,638 ms
コンパイル使用メモリ 169,292 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 09:07:26
合計ジャッジ時間 4,957 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
4,348 KB
testcase_01 AC 22 ms
4,348 KB
testcase_02 AC 22 ms
4,348 KB
testcase_03 AC 22 ms
4,348 KB
testcase_04 AC 22 ms
4,348 KB
testcase_05 AC 22 ms
4,348 KB
testcase_06 AC 22 ms
4,348 KB
testcase_07 AC 22 ms
4,348 KB
testcase_08 AC 23 ms
4,348 KB
testcase_09 AC 22 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 6 ms
4,348 KB
testcase_12 AC 5 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 7 ms
4,348 KB
testcase_15 AC 3 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 6 ms
4,348 KB
testcase_19 AC 6 ms
4,348 KB
testcase_20 AC 24 ms
4,348 KB
testcase_21 AC 24 ms
4,348 KB
testcase_22 AC 22 ms
4,348 KB
testcase_23 AC 22 ms
4,348 KB
testcase_24 AC 22 ms
4,348 KB
testcase_25 AC 22 ms
4,348 KB
testcase_26 AC 22 ms
4,348 KB
testcase_27 AC 23 ms
4,348 KB
testcase_28 WA -
testcase_29 AC 2 ms
4,348 KB
testcase_30 AC 25 ms
4,348 KB
testcase_31 AC 67 ms
4,348 KB
testcase_32 AC 66 ms
4,348 KB
testcase_33 AC 33 ms
4,348 KB
testcase_34 AC 34 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    int a[N];
    vector<int> b(N + 1);
    b[0] = 0;
    
    for (int i = 0; i < N; i++) {
        cin >> a[i];
        b[i + 1] = b[i] + a[i];
    }
    int ans = 1;
    int s = 0;
    for (int i = 0; i < N; i++) {
        int v = b[i + 1];
        s = v;
        int t = 0;
        int l = i + 2;
        int cnt = 1;
        while (l < N) {
            auto it = lower_bound(b.begin() + l, b.end(), v + s);
            int id = it - b.begin();
            if (b[id] == v + s) {
                s = b[id];
                l = id;
                cnt++;
            } else {
                break;
            }
            if (id == N) {
                ans = max(ans, cnt);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}
0