結果
| 問題 |
No.1201 お菓子配り-4
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-01 15:03:14 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,247 ms / 4,000 ms |
| コード長 | 705 bytes |
| コンパイル時間 | 2,820 ms |
| コンパイル使用メモリ | 278,460 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-10-01 15:03:28 |
| 合計ジャッジ時間 | 12,236 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 36 |
ソースコード
// #pragma GCC optimize ("Ofast")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target ("avx,avx2,fma")
#include <bits/stdc++.h>
#define for(i, a, b) for(int i = (a); i <= (b); i ++)
using std::cin, std::cout, std::cerr;
using ll = long long;
const ll P = 1e9 + 7;
int main() {
std::ios::sync_with_stdio(false);
int n, m; cin >> n >> m;
std::vector<int> a(n), b(m);
for(i, 0, n - 1) cin >> a[i];
for(i, 0, m - 1) cin >> b[i];
ll ans = 0;
for(i, 0, n - 1) for(j, 0, m - 1) if(a[i]) {
int g = std::__gcd(a[i], b[j]);
ans += ll(a[i]) * (b[j] +1);
ans -= b[j] - g;
ans %= P;
}
ans = (ans % P + P) % P;
cout << ans << '\n';
}