提出 #16749309


ソースコード 拡げる

#include <iostream>
using i64 = long long;

int main() {
    constexpr i64 mod = 1000000007;
    int n;
    std::cin >> n;

    i64 ret = 0, s = 0;
    for (int i = 0; i < n; i++) {
        i64 a;
        std::cin >> a;
        ret = (ret + a * s) % mod;
        s = (s + a) % mod;
    }

    std::cout << ret << std::endl;

    return 0;
}

提出情報

提出日時
問題 C - Sum of product of pairs
ユーザ CharlotteL
言語 C++ (GCC 9.2.1)
得点 300
コード長 361 Byte
結果 AC
実行時間 72 ms
メモリ 3560 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 19
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All hand_01.txt, hand_02.txt, hand_03.txt, max_01.txt, max_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 8 ms 3456 KiB
hand_02.txt AC 2 ms 3496 KiB
hand_03.txt AC 3 ms 3500 KiB
max_01.txt AC 38 ms 3372 KiB
max_02.txt AC 69 ms 3448 KiB
random_01.txt AC 45 ms 3500 KiB
random_02.txt AC 68 ms 3456 KiB
random_03.txt AC 11 ms 3444 KiB
random_04.txt AC 65 ms 3560 KiB
random_05.txt AC 33 ms 3548 KiB
random_06.txt AC 62 ms 3376 KiB
random_07.txt AC 19 ms 3500 KiB
random_08.txt AC 61 ms 3448 KiB
random_09.txt AC 31 ms 3480 KiB
random_10.txt AC 72 ms 3456 KiB
random_11.txt AC 69 ms 3500 KiB
random_12.txt AC 70 ms 3504 KiB
sample_01.txt AC 4 ms 3500 KiB
sample_02.txt AC 2 ms 3444 KiB