結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー chocoruskchocorusk
提出日時 2021-11-05 21:42:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 369 ms / 2,000 ms
コード長 1,177 bytes
コンパイル時間 3,750 ms
コンパイル使用メモリ 185,896 KB
実行使用メモリ 13,144 KB
最終ジャッジ日時 2024-04-25 17:18:02
合計ジャッジ時間 10,469 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 355 ms
9,088 KB
testcase_01 AC 26 ms
8,276 KB
testcase_02 AC 26 ms
7,552 KB
testcase_03 AC 27 ms
10,324 KB
testcase_04 AC 32 ms
11,476 KB
testcase_05 AC 33 ms
12,108 KB
testcase_06 AC 28 ms
10,584 KB
testcase_07 AC 33 ms
11,468 KB
testcase_08 AC 26 ms
8,276 KB
testcase_09 AC 30 ms
10,960 KB
testcase_10 AC 28 ms
10,444 KB
testcase_11 AC 31 ms
9,040 KB
testcase_12 AC 27 ms
8,524 KB
testcase_13 AC 369 ms
13,012 KB
testcase_14 AC 358 ms
13,012 KB
testcase_15 AC 361 ms
12,876 KB
testcase_16 AC 364 ms
12,884 KB
testcase_17 AC 365 ms
13,144 KB
testcase_18 AC 347 ms
13,004 KB
testcase_19 AC 347 ms
10,572 KB
testcase_20 AC 328 ms
11,984 KB
testcase_21 AC 333 ms
12,236 KB
testcase_22 AC 353 ms
11,216 KB
testcase_23 AC 315 ms
10,952 KB
testcase_24 AC 309 ms
11,084 KB
testcase_25 AC 343 ms
10,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#include <list>
#include <atcoder/all>
#define popcount __builtin_popcount
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef pair<int, int> P;
using mint=modint998244353;
int n;
int a[200020];
int ac[1000010];
int c[1000010];
int ans[200020];
int main()
{
    cin>>n;
    for(int i=0; i<n; i++){
        cin>>a[i];
        ac[a[i]]++;
    }
    for(int d=1; d<=1000000; d++){
        for(int i=d; i<=1000000; i+=d){
            c[d]+=ac[i];
        }
    }
    for(int i=1000000; i>=1; i--){
        c[i]=max(c[i], c[i+1]);
    }
    int k=0;
    for(int i=1000000; i>=1; i--){
        while(c[i]>k){
            k++;
            ans[k]=i;
        }
    }
    for(int i=n; i>=1; i--) cout<<ans[i]<<endl;
    return 0;
}
0