結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー ytft
提出日時 2021-12-28 17:02:02
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 509 bytes
コンパイル時間 1,854 ms
コンパイル使用メモリ 171,408 KB
実行使用メモリ 20,388 KB
最終ジャッジ日時 2024-10-02 09:52:51
合計ジャッジ時間 12,306 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 TLE * 2 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N,temp;
    multiset<int> A;
    cin>>N;
    int ans[N];
    fill(ans,ans+N,0);
    for(int i=0;i<N;++i){
        cin>>temp;
        A.insert(temp);
    }
    for(int i=1;i<=*A.rbegin();++i){
        temp=0;
        for(int j=i;j<=*A.rbegin();j+=i){
            temp+=A.count(j);
        }
        ans[N-temp]=i;
    }
    cout<<ans[0]<<endl;
    for(int i=1;i<N;++i){
        ans[i]=max(ans[i],ans[i-1]);
        cout<<ans[i]<<endl;
    }
}
0