結果

問題 No.1233 割り切れない気持ち
ユーザー chocoruskchocorusk
提出日時 2020-09-18 21:57:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 63 ms / 3,153 ms
コード長 1,025 bytes
コンパイル時間 1,072 ms
コンパイル使用メモリ 127,632 KB
実行使用メモリ 6,756 KB
最終ジャッジ日時 2023-09-04 21:47:18
合計ジャッジ時間 4,379 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,764 KB
testcase_01 AC 4 ms
5,992 KB
testcase_02 AC 5 ms
5,976 KB
testcase_03 AC 7 ms
5,696 KB
testcase_04 AC 5 ms
6,284 KB
testcase_05 AC 4 ms
6,472 KB
testcase_06 AC 5 ms
5,900 KB
testcase_07 AC 20 ms
6,096 KB
testcase_08 AC 30 ms
6,244 KB
testcase_09 AC 52 ms
6,472 KB
testcase_10 AC 54 ms
6,484 KB
testcase_11 AC 19 ms
6,472 KB
testcase_12 AC 63 ms
6,628 KB
testcase_13 AC 63 ms
6,480 KB
testcase_14 AC 63 ms
6,676 KB
testcase_15 AC 62 ms
6,476 KB
testcase_16 AC 62 ms
6,540 KB
testcase_17 AC 30 ms
6,592 KB
testcase_18 AC 63 ms
6,632 KB
testcase_19 AC 59 ms
6,468 KB
testcase_20 AC 30 ms
6,532 KB
testcase_21 AC 42 ms
6,612 KB
testcase_22 AC 41 ms
6,612 KB
testcase_23 AC 42 ms
6,544 KB
testcase_24 AC 42 ms
6,524 KB
testcase_25 AC 41 ms
6,484 KB
testcase_26 AC 42 ms
6,532 KB
testcase_27 AC 49 ms
6,488 KB
testcase_28 AC 49 ms
6,552 KB
testcase_29 AC 49 ms
6,468 KB
testcase_30 AC 48 ms
6,540 KB
testcase_31 AC 50 ms
6,480 KB
testcase_32 AC 49 ms
6,592 KB
testcase_33 AC 50 ms
6,484 KB
testcase_34 AC 49 ms
6,496 KB
testcase_35 AC 49 ms
6,544 KB
testcase_36 AC 49 ms
6,756 KB
testcase_37 AC 3 ms
6,032 KB
testcase_38 AC 30 ms
6,484 KB
testcase_39 AC 46 ms
6,548 KB
testcase_40 AC 46 ms
6,480 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>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main()
{
	int n; cin>>n;
	int c[200020]={};
	ll s[200020]={};
	int a[200020];
	for(int i=0; i<n; i++){
		cin>>a[i];
		c[a[i]]++;
	}
	for(int i=0; i<=200010; i++) s[i+1]=s[i]+c[i];
	ll sum=0;
	for(int i=1; i<=200000; i++){
		if(c[i]==0) continue;
		ll sum1=0;
		for(int j=1; j<=200000/i; j++){
			sum1+=(s[min(200010, (j+1)*i)]-s[j*i])*j;
		}
		sum+=sum1*i*c[i];
	}
	ll ans=0;
	for(int i=0; i<n; i++){
		ans+=a[i];
	}
	ans*=n;
	ans-=sum;
	cout<<ans<<endl;
	return 0;
}
0