結果

問題 No.1201 お菓子配り-4
ユーザー erbowlerbowl
提出日時 2021-02-13 16:03:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 648 bytes
コンパイル時間 1,889 ms
コンパイル使用メモリ 201,812 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-28 00:31:19
合計ジャッジ時間 9,329 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
4,376 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 159 ms
4,376 KB
testcase_04 AC 73 ms
4,380 KB
testcase_05 AC 190 ms
4,380 KB
testcase_06 AC 30 ms
4,384 KB
testcase_07 AC 80 ms
4,376 KB
testcase_08 AC 240 ms
4,376 KB
testcase_09 AC 175 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 46 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 11 ms
4,376 KB
testcase_14 AC 6 ms
4,380 KB
testcase_15 AC 258 ms
4,376 KB
testcase_16 AC 79 ms
4,380 KB
testcase_17 AC 98 ms
4,380 KB
testcase_18 AC 18 ms
4,376 KB
testcase_19 AC 17 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 126 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

typedef long long ll;
typedef long double ld;
#include <bits/stdc++.h>
using namespace std;

int main() {
    ll n,m;
    std::cin >> n>>m;
        const ll MOD = 1e9+7;

    vector<ll> a(n),b(m);
    ll sum = 0;
    for (int i = 0; i < n; i++) {
        std::cin >> a[i];
        sum += a[i];
        sum %= MOD;
    }
    
    for (int i = 0; i < m; i++) {
        std::cin >> b[i];
    }
    ll ans = 0;
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
            ll g = gcd(a[j],b[i]);
            ans += a[j]%MOD*(b[i]+1) - (b[i]-g+MOD)%MOD+MOD;
        }
        ans %= MOD;
    }
    std::cout << ans << std::endl;
}
0