結果

問題 No.1201 お菓子配り-4
ユーザー chocoruskchocorusk
提出日時 2020-08-28 21:54:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 434 ms / 4,000 ms
コード長 917 bytes
コンパイル時間 1,051 ms
コンパイル使用メモリ 126,380 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-08 20:26:23
合計ジャッジ時間 7,006 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
4,380 KB
testcase_01 AC 211 ms
4,380 KB
testcase_02 AC 302 ms
4,380 KB
testcase_03 AC 147 ms
4,380 KB
testcase_04 AC 73 ms
4,376 KB
testcase_05 AC 179 ms
4,380 KB
testcase_06 AC 29 ms
4,380 KB
testcase_07 AC 82 ms
4,376 KB
testcase_08 AC 224 ms
4,376 KB
testcase_09 AC 165 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 44 ms
4,380 KB
testcase_12 AC 343 ms
4,376 KB
testcase_13 AC 11 ms
4,376 KB
testcase_14 AC 6 ms
4,376 KB
testcase_15 AC 269 ms
4,376 KB
testcase_16 AC 83 ms
4,376 KB
testcase_17 AC 107 ms
4,384 KB
testcase_18 AC 19 ms
4,376 KB
testcase_19 AC 18 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 432 ms
4,380 KB
testcase_31 AC 433 ms
4,376 KB
testcase_32 AC 434 ms
4,380 KB
testcase_33 AC 434 ms
4,376 KB
testcase_34 AC 434 ms
4,376 KB
testcase_35 AC 140 ms
4,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