/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 6ms 1.27 MiB
#2 Wrong Answer 42ms 1.312 MiB
#3 Wrong Answer 41ms 1.27 MiB

Code

#include "bits/stdc++.h"

using namespace std;
using ll = long long;
#define int ll
#define endl '\n'
const int mod = 1000000007;
// clang-format off
template<typename typC,typename typD> istream &operator>>(istream &cin,pair<typC,typD> &a) { return cin>>a.first>>a.second; }
template<typename typC> istream &operator>>(istream &cin,vector<typC> &a) { for (auto &x:a) cin>>x; return cin; }
template<typename typC,typename typD> ostream &operator<<(ostream &cout,const pair<typC,typD> &a) { return cout<<a.first<<' '<<a.second; }
template<typename typC,typename typD> ostream &operator<<(ostream &cout,const vector<pair<typC,typD>> &a) { for (auto &x:a) cout<<x<<'\n'; return cout; }
template<typename typC> ostream &operator<<(ostream &cout,const vector<typC> &a) { int n=a.size(); if (!n) return cout; cout<<a[0]; for (int i=1; i<n; i++) cout<<' '<<a[i]; return cout; }
// #define _GLIBCXX_DEBUG
// clang-format on

void solve()
{
    ll t, m, n, a, b;
    string h;
    cin >> n;
    vector<int> v(n);
    cin >> v;
    vector<int> v1(1e5 + 1);
    for (int i = 1; i <= 1e5; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (v[j] % i == 0)
                v1[i]++;
            if (v[j] > 1e5)
            {
                a = a / 0;
            }
        }
    }
    map<int, int> mp;
    for (int i = 1; i <= 1e5; i++)
    {
        mp[v1[i]] = max(mp[v1[i]], i);
    }
    vector<int> ans(n + 1);
    int maxx = 0;
    for (int i = n; i >= 1; i--)
    {
        maxx = max(maxx, mp[i]);
        ans[i] = maxx;
    }
    for (int i = 1; i <= n; i++)
        cout << ans[i] << " ";
    cout << endl;
}
int32_t main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t;
    // cin >> t;
    // while (t--)
    {
        solve();
    }
    return 0;
}

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 15:33:52
Judged At
2025-01-02 15:33:52
Judged By
Score
0
Total Time
42ms
Peak Memory
1.312 MiB