結果

問題 No.1730 GCD on Blackboard in yukicoder
コンテスト
ユーザー kotatsugame
提出日時 2021-11-05 21:38:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 322 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 65,384 KB
実行使用メモリ 7,888 KB
最終ジャッジ日時 2024-11-06 12:23:37
合計ジャッジ時間 5,563 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 RE * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
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