結果

問題 No.1443 Andd
ユーザー Live Youtube Channel Promotion Free
提出日時 2023-03-31 05:53:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 574 bytes
コンパイル時間 732 ms
コンパイル使用メモリ 70,876 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-22 12:56:25
合計ジャッジ時間 2,887 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<int> ans(n-1, 0);
    int x = 0;
    for (int i = 0; i < n-1; i++) {
        x = x + a[i];
        int y = x;
        for (int j = i+1; j < n; j++) {
            y = y & a[j];
            ans[j-i-1] |= y;
        }
    }

    int cnt = 0;
    for (int i = 0; i < n-1; i++) {
        if (ans[i] != 0) {
            cnt++;
        }
    }

    cout << cnt << endl;

    return 0;
}
0