/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Wrong Answer 14ms 564.0 KiB
#3 Wrong Answer 14ms 504.0 KiB

Code

#include <bits/stdc++.h>

using namespace std;

// #include "debug.h"

void solve() {
        int n;
        cin >> n;

        vector<int> a(n);
        for (int i = 0; i < n; ++i) {
                cin >> a[i];
        }

        vector<int> ans(n + 1);
        for (int i = 1; i <= 1e5; ++i) {
                int cnt = 0;

                for (int j = 0; j < n; ++j) {
                        cnt += (a[j] % i == 0);
                }

                for (int j = 1; j <= cnt; ++j) {
                        ans[j] = i;
                }
        }

        for (int i = 1; i <= n; ++i) {
                cout << ans[i] << ' ';
        }
        cout << '\n';
}

int32_t main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);

        int tc = 1;

        while (tc--) {
                solve();
        }
}

Information

Submit By
Type
Submission
Problem
P1151 Max gcd group
Contest
Happy New Year 2025
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-02 14:53:41
Judged At
2025-01-02 14:53:41
Judged By
Score
0
Total Time
14ms
Peak Memory
564.0 KiB