結果

問題 No.1505 Zero-Product Ranges
ユーザー hiikunZhiikunZ
提出日時 2021-05-14 22:32:55
言語 C++17
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 1,773 ms
使用メモリ 6,300 KB
最終ジャッジ日時 2022-11-25 19:36:14
合計ジャッジ時間 4,077 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,532 KB
testcase_01 AC 2 ms
3,376 KB
testcase_02 AC 1 ms
3,428 KB
testcase_03 AC 25 ms
6,208 KB
testcase_04 AC 24 ms
6,272 KB
testcase_05 AC 10 ms
4,364 KB
testcase_06 AC 10 ms
4,496 KB
testcase_07 AC 8 ms
3,944 KB
testcase_08 AC 10 ms
4,216 KB
testcase_09 AC 9 ms
4,092 KB
testcase_10 AC 9 ms
4,236 KB
testcase_11 AC 10 ms
4,500 KB
testcase_12 AC 8 ms
3,932 KB
testcase_13 AC 15 ms
4,936 KB
testcase_14 AC 14 ms
4,628 KB
testcase_15 AC 23 ms
6,020 KB
testcase_16 AC 27 ms
6,272 KB
testcase_17 AC 26 ms
6,256 KB
testcase_18 AC 26 ms
6,248 KB
testcase_19 AC 1 ms
3,480 KB
testcase_20 AC 1 ms
3,380 KB
testcase_21 AC 1 ms
3,376 KB
testcase_22 AC 26 ms
6,276 KB
testcase_23 AC 26 ms
5,948 KB
testcase_24 AC 25 ms
6,088 KB
testcase_25 AC 25 ms
6,004 KB
testcase_26 AC 25 ms
6,012 KB
testcase_27 AC 25 ms
6,020 KB
testcase_28 AC 25 ms
5,944 KB
testcase_29 AC 26 ms
5,944 KB
testcase_30 AC 27 ms
6,300 KB
testcase_31 AC 25 ms
5,996 KB
testcase_32 AC 14 ms
4,748 KB
testcase_33 AC 13 ms
4,768 KB
testcase_34 AC 15 ms
4,680 KB
testcase_35 AC 12 ms
4,364 KB
testcase_36 AC 12 ms
4,408 KB
testcase_37 AC 14 ms
4,632 KB
testcase_38 AC 13 ms
4,436 KB
testcase_39 AC 13 ms
4,628 KB
testcase_40 AC 13 ms
4,676 KB
testcase_41 AC 15 ms
4,948 KB
testcase_42 AC 2 ms
3,552 KB
testcase_43 AC 4 ms
3,448 KB
testcase_44 AC 3 ms
3,708 KB
testcase_45 AC 3 ms
3,432 KB
testcase_46 AC 3 ms
3,680 KB
testcase_47 AC 4 ms
3,496 KB
testcase_48 AC 2 ms
3,720 KB
testcase_49 AC 2 ms
3,528 KB
testcase_50 AC 3 ms
3,648 KB
testcase_51 AC 3 ms
3,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long int;
using ld = long double;
#define pow(n,m) powl(n,m)
#define sqrt(n) sqrtl(n)
const ll MAX = 1000000000000000000;
const ll MOD = 1000000007;
//998244353;
void randinit(){srand((unsigned)time(NULL));}
int main(){
    ll N;
    cin >> N;
    vector<ll> A(N),B(N,N);
    for(ll i = 0;i < N;i++) cin >> A[i];
    for(ll i = N - 1;i >= 0;i--){
        if(i != N - 1) B[i] = B[i + 1];
        if(A[i] == 0) B[i] = i;
    }
    ll ans = 0;
    for(ll i = 0;i < N;i++) ans += N - B[i];
    cout << ans << endl;
}
0