//泥の分際で私だけの大切を奪おうだなん #include<bits/stdc++.h> using namespace std; inline int read(){ int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();} while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar(); return s*w; } int ans[1<<19]; signed main() { int n=read(); map<int,int> mp; for(int i=1; i<=n; ++i) ++mp[read()]; for(auto [x,y]:mp) for(int i=1; i<=y; ++i) ans[i]+=y-(y%i); for(int i=1; i<=n; ++i) printf("%d ",ans[i]); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | //泥の分際で私だけの大切を奪おうだなん #include<bits/stdc++.h> using namespace std; inline int read(){ int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();} while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar(); return s*w; } int ans[1<<19]; signed main() { int n=read(); map<int,int> mp; for(int i=1; i<=n; ++i) ++mp[read()]; for(auto [x,y]:mp) for(int i=1; i<=y; ++i) ans[i]+=y-(y%i); for(int i=1; i<=n; ++i) printf("%d ",ans[i]); return 0; } |