結果
| 問題 |
No.1201 お菓子配り-4
|
| コンテスト | |
| ユーザー |
PCTprobability
|
| 提出日時 | 2020-08-26 18:32:31 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 868 bytes |
| コンパイル時間 | 8,001 ms |
| コンパイル使用メモリ | 255,968 KB |
| 最終ジャッジ日時 | 2025-01-13 15:01:30 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | RE * 36 |
ソースコード
#include <iostream>
#include <random>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll mygcd(ll a, ll b)
{
if (a%b == 0)
{
return(b);
}
else
{
return(mygcd(b, a%b));
}
}
int main(){
ll n,m;
cin>>n>>m;
assert(1<=n&&n<=2000&&1<=m&&m<=2000);
vector<ll> a(n);
vector<ll> b(m);
for(int i=0;i<n;i++){
assert(a.at(i)>=0&&a.at(i)<=100000000);
cin>>a.at(i);
}
for(int i=0;i<m;i++){
assert(b.at(i)>=1&&b.at(i)<=100000000);
cin>>b.at(i);
}
ll ans=0;
ll x,y;
x=0;
y=0;
for(int i=0;i<n;i++){
x=(x+a.at(i)-1)%1000000007;
}
for(int i=0;i<m;i++){
y=(y+b.at(i)+1)%1000000007;
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
ans=(ans+mygcd(a.at(i),b.at(j)))%1000000007;
}
}
ans=(ans+((x*y)%1000000007)+((m*n)%1000000007))%1000000007;
cout<<ans<<endl;
}
PCTprobability