/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Wrong Answer 2ms 516.0 KiB
#3 Wrong Answer 1ms 540.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define pb              push_back
#define endl            '\n'
#define ff              first
#define ss              second
void edm()
{
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
void solve()
{
    int n;cin>>n;
    map<int,int>mp;
    for(int i=0;i<n;i++)
    {
        int x;cin>>x;
        for(int j=1;j<=x;j++)
        {
            if(x%j==0)mp[j]++;
        }
    }
    for(int i=1;i<=n;i++)
    {
        int mx=0;
        for(auto j:mp)
        {
            if(j.ss>=i)
            {
                mx = max(mx,j.ff);
            }
        }
        cout<<mx<<" ";
    }
    cout<<endl;
}
int32_t main()
{
    //edm();
    int t = 1;
    //cin>>t;
    for(int i=1;i<=t;i++)
    {
        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 15:34:58
Judged At
2025-01-02 15:34:58
Judged By
Score
0
Total Time
2ms
Peak Memory
540.0 KiB