結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー kotatsugamekotatsugame
提出日時 2021-11-05 21:38:19
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 322 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 65,600 KB
実行使用メモリ 7,888 KB
最終ジャッジ日時 2024-04-24 05:25:09
合計ジャッジ時間 5,194 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 17 ms
5,376 KB
testcase_02 AC 17 ms
5,376 KB
testcase_03 AC 12 ms
5,376 KB
testcase_04 AC 10 ms
5,376 KB
testcase_05 AC 11 ms
5,376 KB
testcase_06 AC 11 ms
5,376 KB
testcase_07 AC 11 ms
5,376 KB
testcase_08 AC 17 ms
5,376 KB
testcase_09 AC 10 ms
5,376 KB
testcase_10 AC 12 ms
5,376 KB
testcase_11 AC 17 ms
5,376 KB
testcase_12 AC 17 ms
5,376 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 306 ms
5,376 KB
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int N;
int cA[1<<20];
int ans[1<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)
	{
		int A;cin>>A;
		cA[A]++;
	}
	int mx=0;
	for(int d=1<<20;--d;)
	{
		int c=0;
		for(int v=d;v<1<<20;v+=d)c+=cA[v];
		while(mx<c)
		{
			ans[N-++mx]=d;
		}
	}
	for(int i=0;i<N;i++)cout<<ans[i]<<endl;
}
0