結果

問題 No.1201 お菓子配り-4
ユーザー chocoruskchocorusk
提出日時 2020-08-28 21:54:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 419 ms / 4,000 ms
コード長 917 bytes
コンパイル時間 1,257 ms
コンパイル使用メモリ 125,968 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-26 12:53:19
合計ジャッジ時間 6,738 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
5,248 KB
testcase_01 AC 208 ms
5,376 KB
testcase_02 AC 298 ms
5,376 KB
testcase_03 AC 145 ms
5,376 KB
testcase_04 AC 72 ms
5,376 KB
testcase_05 AC 174 ms
5,376 KB
testcase_06 AC 28 ms
5,376 KB
testcase_07 AC 79 ms
5,376 KB
testcase_08 AC 214 ms
5,376 KB
testcase_09 AC 160 ms
5,376 KB
testcase_10 AC 3 ms
5,376 KB
testcase_11 AC 44 ms
5,376 KB
testcase_12 AC 328 ms
5,376 KB
testcase_13 AC 11 ms
5,376 KB
testcase_14 AC 6 ms
5,376 KB
testcase_15 AC 260 ms
5,376 KB
testcase_16 AC 79 ms
5,376 KB
testcase_17 AC 103 ms
5,376 KB
testcase_18 AC 18 ms
5,376 KB
testcase_19 AC 17 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 419 ms
5,376 KB
testcase_31 AC 410 ms
5,376 KB
testcase_32 AC 417 ms
5,376 KB
testcase_33 AC 409 ms
5,376 KB
testcase_34 AC 417 ms
5,376 KB
testcase_35 AC 123 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n, m; cin>>n>>m;
	ll a[2020], b[2020];
	for(int i=0; i<n; i++) cin>>a[i];
	for(int i=0; i<m; i++) cin>>b[i];
	const ll MOD=1e9+7;
	ll ans=0;
	for(int i=0; i<n; i++){
		if(a[i]==0) continue;
		for(int j=0; j<m; j++){
			ans+=(a[i]-1)*(b[j]-1)+gcd(a[i], b[j])-1+2*a[i];
			ans%=MOD;
		}
	}
	cout<<ans<<endl;
	return 0;
}
0