結果

問題 No.1505 Zero-Product Ranges
ユーザー kokatsukokatsu
提出日時 2022-05-08 23:07:20
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 283 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 204,120 KB
実行使用メモリ 11,152 KB
最終ジャッジ日時 2023-09-04 17:05:08
合計ジャッジ時間 6,539 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 19 ms
10,420 KB
testcase_04 AC 18 ms
10,416 KB
testcase_05 AC 10 ms
7,368 KB
testcase_06 AC 9 ms
6,516 KB
testcase_07 AC 7 ms
5,056 KB
testcase_08 AC 9 ms
6,792 KB
testcase_09 AC 9 ms
7,596 KB
testcase_10 AC 8 ms
7,596 KB
testcase_11 AC 9 ms
6,584 KB
testcase_12 AC 7 ms
5,004 KB
testcase_13 AC 12 ms
8,452 KB
testcase_14 AC 11 ms
8,100 KB
testcase_15 AC 18 ms
9,820 KB
testcase_16 AC 19 ms
10,628 KB
testcase_17 AC 20 ms
10,632 KB
testcase_18 AC 21 ms
10,692 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 20 ms
11,152 KB
testcase_23 AC 19 ms
9,672 KB
testcase_24 AC 19 ms
9,428 KB
testcase_25 AC 19 ms
9,796 KB
testcase_26 AC 19 ms
9,004 KB
testcase_27 AC 19 ms
10,132 KB
testcase_28 AC 19 ms
10,320 KB
testcase_29 AC 19 ms
10,824 KB
testcase_30 AC 20 ms
10,424 KB
testcase_31 AC 19 ms
9,832 KB
testcase_32 AC 11 ms
7,584 KB
testcase_33 AC 11 ms
8,136 KB
testcase_34 AC 12 ms
7,616 KB
testcase_35 AC 10 ms
7,400 KB
testcase_36 AC 10 ms
7,896 KB
testcase_37 AC 12 ms
7,636 KB
testcase_38 AC 11 ms
7,396 KB
testcase_39 AC 11 ms
7,892 KB
testcase_40 AC 11 ms
7,300 KB
testcase_41 AC 13 ms
8,640 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 4 ms
4,508 KB
testcase_44 AC 3 ms
4,380 KB
testcase_45 AC 3 ms
4,380 KB
testcase_46 AC 2 ms
4,384 KB
testcase_47 AC 4 ms
4,384 KB
testcase_48 AC 3 ms
4,508 KB
testcase_49 AC 2 ms
4,380 KB
testcase_50 AC 3 ms
4,380 KB
testcase_51 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    long N;
    readf("%d\n", N);

    auto A = readln.chomp.split.to!(long[]);

    long res = N * (N + 1) / 2, r;
    foreach (l; 0 .. N) {
        while (r < N && A[r] == 1) ++r;

        res -= r - l;

        if (l == r) ++r;
    }

    res.writeln;
}
0