結果

問題 No.1681 +-*
ユーザー 259_Momone259_Momone
提出日時 2021-09-17 21:38:35
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 592 bytes
コンパイル時間 2,019 ms
コンパイル使用メモリ 201,748 KB
実行使用メモリ 6,452 KB
最終ジャッジ日時 2023-09-12 07:03:51
合計ジャッジ時間 4,116 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 42 ms
6,452 KB
testcase_06 AC 42 ms
6,300 KB
testcase_07 AC 42 ms
6,220 KB
testcase_08 AC 75 ms
6,152 KB
testcase_09 AC 75 ms
6,200 KB
testcase_10 AC 75 ms
6,220 KB
testcase_11 AC 75 ms
6,284 KB
testcase_12 AC 75 ms
6,176 KB
testcase_13 AC 39 ms
4,900 KB
testcase_14 AC 76 ms
6,236 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 76 ms
6,200 KB
testcase_18 AC 75 ms
6,172 KB
testcase_19 AC 75 ms
6,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

int main(){
    using namespace std;
    constexpr unsigned long MOD{1000000007};
    unsigned long N;
    cin >> N;
    const auto mul_mod{[](auto a, auto b){return a * b % MOD;}};
    vector<unsigned long> A(N);
    for(auto&& i : A)cin >> i;
    inclusive_scan(begin(A), end(A), begin(A), mul_mod);
    vector<unsigned long> coef(N, 3);
    coef.back() = 1;
    coef.rbegin()[1] = 2;
    inclusive_scan(rbegin(coef), rend(coef), rbegin(coef), mul_mod);
    cout << inner_product(begin(A), end(A), begin(coef), 0UL, plus<>{}, mul_mod) % MOD << endl;
    return 0;
}
0