結果

問題 No.1262 グラフを作ろう!
ユーザー 👑 kmjpkmjp
提出日時 2020-10-16 23:42:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,210 bytes
コンパイル時間 1,998 ms
コンパイル使用メモリ 200,240 KB
実行使用メモリ 23,364 KB
最終ジャッジ日時 2023-09-28 06:14:08
合計ジャッジ時間 24,876 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,277 ms
23,052 KB
testcase_01 AC 2,477 ms
23,024 KB
testcase_02 AC 2,253 ms
23,112 KB
testcase_03 AC 2,302 ms
23,028 KB
testcase_04 AC 2,177 ms
23,028 KB
testcase_05 AC 2,238 ms
23,284 KB
testcase_06 AC 2,206 ms
23,060 KB
testcase_07 AC 2,192 ms
23,060 KB
testcase_08 AC 2,217 ms
23,224 KB
testcase_09 AC 2,347 ms
23,008 KB
testcase_10 AC 2,289 ms
23,220 KB
testcase_11 AC 2,410 ms
23,308 KB
testcase_12 AC 2,335 ms
23,344 KB
testcase_13 AC 2,451 ms
23,288 KB
testcase_14 AC 2,327 ms
23,000 KB
testcase_15 AC 2,341 ms
23,204 KB
testcase_16 AC 2,413 ms
23,360 KB
testcase_17 AC 2,302 ms
23,056 KB
testcase_18 AC 2,503 ms
23,052 KB
testcase_19 AC 2,229 ms
23,052 KB
testcase_20 AC 2,335 ms
23,308 KB
testcase_21 AC 2,357 ms
23,288 KB
testcase_22 AC 2,207 ms
23,224 KB
testcase_23 AC 2,397 ms
23,360 KB
testcase_24 AC 2,256 ms
23,312 KB
testcase_25 AC 2,188 ms
23,364 KB
testcase_26 AC 2,192 ms
23,312 KB
testcase_27 AC 2,210 ms
23,224 KB
testcase_28 AC 2,236 ms
23,308 KB
testcase_29 AC 2,220 ms
22,992 KB
testcase_30 AC 2,224 ms
23,152 KB
testcase_31 AC 2,328 ms
23,224 KB
testcase_32 AC 2,310 ms
23,152 KB
testcase_33 AC 2,214 ms
23,004 KB
testcase_34 AC 2,231 ms
23,148 KB
testcase_35 AC 2,263 ms
23,056 KB
testcase_36 AC 2,209 ms
23,292 KB
testcase_37 AC 2,343 ms
23,340 KB
testcase_38 AC 2,230 ms
23,060 KB
testcase_39 AC 2,241 ms
23,104 KB
testcase_40 AC 2,266 ms
23,008 KB
testcase_41 AC 2,226 ms
23,052 KB
testcase_42 AC 2,287 ms
23,316 KB
testcase_43 AC 2,267 ms
23,312 KB
testcase_44 AC 2,241 ms
23,076 KB
testcase_45 AC 2,285 ms
23,112 KB
testcase_46 AC 2,236 ms
23,308 KB
testcase_47 AC 2,274 ms
23,344 KB
testcase_48 AC 2,546 ms
23,008 KB
testcase_49 AC 2,338 ms
23,224 KB
testcase_50 AC 2,303 ms
23,056 KB
testcase_51 AC 2,251 ms
23,364 KB
testcase_52 AC 2,250 ms
23,340 KB
testcase_53 AC 2,240 ms
23,116 KB
testcase_54 AC 2,280 ms
23,084 KB
testcase_55 AC 2,239 ms
23,056 KB
testcase_56 AC 2,222 ms
23,104 KB
testcase_57 AC 2,334 ms
23,052 KB
testcase_58 AC 2,304 ms
23,008 KB
testcase_59 AC 2,261 ms
23,052 KB
testcase_60 AC 2,324 ms
23,056 KB
testcase_61 AC 2,260 ms
23,308 KB
testcase_62 AC 2,292 ms
23,152 KB
testcase_63 AC 2,275 ms
23,224 KB
testcase_64 AC 2,266 ms
23,052 KB
testcase_65 AC 2,206 ms
23,148 KB
testcase_66 AC 2,244 ms
23,224 KB
testcase_67 AC 2,237 ms
23,080 KB
testcase_68 AC 2,206 ms
23,152 KB
testcase_69 AC 2,215 ms
23,228 KB
testcase_70 AC 2,243 ms
23,008 KB
testcase_71 AC 2,246 ms
23,256 KB
testcase_72 AC 2,246 ms
23,004 KB
testcase_73 AC 2,275 ms
23,076 KB
testcase_74 AC 2,286 ms
23,000 KB
testcase_75 AC 2,270 ms
23,008 KB
testcase_76 AC 2,252 ms
23,056 KB
testcase_77 AC 2,275 ms
23,340 KB
testcase_78 AC 2,268 ms
23,152 KB
testcase_79 AC 2,269 ms
23,116 KB
testcase_80 AC 2,259 ms
23,308 KB
testcase_81 AC 2,280 ms
23,224 KB
testcase_82 AC 2,277 ms
23,344 KB
testcase_83 AC 2,291 ms
23,060 KB
testcase_84 AC 2,271 ms
23,224 KB
testcase_85 AC 2,289 ms
23,288 KB
testcase_86 AC 2,276 ms
23,052 KB
testcase_87 TLE -
testcase_88 AC 2,644 ms
23,008 KB
testcase_89 AC 2,236 ms
22,996 KB
testcase_90 AC 2,294 ms
23,224 KB
testcase_91 AC 2,270 ms
23,116 KB
testcase_92 AC 2,285 ms
23,012 KB
testcase_93 AC 2,292 ms
23,228 KB
testcase_94 AC 2,260 ms
23,000 KB
testcase_95 AC 2,266 ms
23,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
int A[1010101];
ll sum[1010101];
ll phi[1010101];
int di[1010101];
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	
	for(i=1;i<=1000000;i++) phi[i]=i;
	for(i=2;i<=1000000;i++) if(di[i]==0) {
		for(j=i;j<=1000000;j+=i) di[j]=i, phi[j]=phi[j]/i*(i-1);
	}
	
	sum[1]=1;
	for(i=2;i<=1000000;i++) {
		for(j=1;j*j<=i;j++) if(i%j==0) {
			sum[i]+=j*phi[i/j];
			if(j*j!=i) sum[i]+=(i/j)*phi[j];
		}
	}
	
	ll ret=0;
	FOR(i,M) {
		cin>>x;
		ret+=sum[x]-x;
	}
	
	cout<<ret<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0