結果

問題 No.1514 Squared Matching
ユーザー kotatsugamekotatsugame
提出日時 2021-05-21 21:44:54
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 578 ms / 4,000 ms
コード長 364 bytes
コンパイル時間 709 ms
コンパイル使用メモリ 69,740 KB
実行使用メモリ 394,284 KB
最終ジャッジ日時 2024-04-18 15:01:25
合計ジャッジ時間 13,915 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 287 ms
199,112 KB
testcase_01 AC 577 ms
394,284 KB
testcase_02 AC 282 ms
199,496 KB
testcase_03 AC 284 ms
199,108 KB
testcase_04 AC 286 ms
198,980 KB
testcase_05 AC 281 ms
199,496 KB
testcase_06 AC 294 ms
203,820 KB
testcase_07 AC 327 ms
238,500 KB
testcase_08 AC 548 ms
388,644 KB
testcase_09 AC 516 ms
364,072 KB
testcase_10 AC 530 ms
377,640 KB
testcase_11 AC 562 ms
386,220 KB
testcase_12 AC 554 ms
391,212 KB
testcase_13 AC 557 ms
393,124 KB
testcase_14 AC 562 ms
394,280 KB
testcase_15 AC 568 ms
394,280 KB
testcase_16 AC 571 ms
394,156 KB
testcase_17 AC 569 ms
394,152 KB
testcase_18 AC 570 ms
394,148 KB
testcase_19 AC 559 ms
394,280 KB
testcase_20 AC 578 ms
394,280 KB
testcase_21 AC 555 ms
394,152 KB
testcase_22 AC 332 ms
240,548 KB
testcase_23 AC 380 ms
277,676 KB
testcase_24 AC 432 ms
317,480 KB
testcase_25 AC 507 ms
355,880 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<map>
using namespace std;
int N;
const int LIM=5e7;
int isp[LIM+1];
int mp[LIM+1];
main()
{
	for(int i=2;i*i<=LIM;i++)
	{
		for(int j=i*i;j<=LIM;j+=i*i)isp[j]=i*i;
	}
	cin>>N;
	for(int i=1;i<=N;i++)
	{
		int t=i;
		while(isp[t]>0)t/=isp[t];
		mp[t]++;
	}
	long ans=0;
	for(int i=1;i<=LIM;i++)ans+=(long)mp[i]*mp[i];
	cout<<ans<<endl;
}
0