Submission #8049281


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     @hamayanhamayan
    /   \     | |
    /   / ̄ ̄ ̄ ̄/  |
  __(__ニつ/     _/ .| .|____
     \/____/ (u ⊃
---------------------------------------------------------------------------------------------------*/














int N, A[301010];
int B[301010], C[301010];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];

	map<int, int> cnt;
	rep(i, 0, N) cnt[A[i]]++;

	fore(p, cnt) B[p.second] += p.second;
	fore(p, cnt) C[p.second]++;

	rrep(i, 301000, 0) B[i] += B[i + 1];
	rrep(i, 301000, 0) C[i] += C[i + 1];

	rep(k, 1, N + 1) {
		int ans = 0;

		rep(cand, 1, N / k + 1) {
			int rest = N - (B[cand] - C[cand] * cand);
			if (cand * k <= rest) chmax(ans, cand);
		}
		
		printf("%d\n", ans);
	}
}





Submission Info

Submission Time
Task F - Distinct Numbers
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 600
Code Size 1895 Byte
Status AC
Exec Time 223 ms
Memory 17920 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 40
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-small-01.txt, 01-small-02.txt, 01-small-03.txt, 01-small-04.txt, 01-small-05.txt, 01-small-06.txt, 01-small-07.txt, 01-small-08.txt, 01-small-09.txt, 01-small-10.txt, 02-medium-01.txt, 02-medium-02.txt, 02-medium-03.txt, 02-medium-04.txt, 02-medium-05.txt, 02-medium-06.txt, 02-medium-07.txt, 02-medium-08.txt, 02-medium-09.txt, 02-medium-10.txt, 11-large-01.txt, 11-large-02.txt, 11-large-03.txt, 21-biased-01.txt, 21-biased-02.txt, 21-biased-03.txt, 31-uni-01.txt, 31-uni-02.txt, 31-uni-03.txt, 41-distinct-01.txt, 41-distinct-02.txt, 41-distinct-03.txt, 51-min-01.txt, 52-max-01.txt, 52-max-02.txt, 52-max-03.txt, 61-sqrt-01.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 4 ms 2560 KB
00-sample-02.txt AC 4 ms 2560 KB
00-sample-03.txt AC 4 ms 2560 KB
01-small-01.txt AC 4 ms 2560 KB
01-small-02.txt AC 4 ms 2560 KB
01-small-03.txt AC 4 ms 2560 KB
01-small-04.txt AC 4 ms 2560 KB
01-small-05.txt AC 4 ms 2560 KB
01-small-06.txt AC 4 ms 2560 KB
01-small-07.txt AC 4 ms 2560 KB
01-small-08.txt AC 4 ms 2560 KB
01-small-09.txt AC 4 ms 2560 KB
01-small-10.txt AC 4 ms 2560 KB
02-medium-01.txt AC 4 ms 2688 KB
02-medium-02.txt AC 4 ms 2560 KB
02-medium-03.txt AC 4 ms 2560 KB
02-medium-04.txt AC 4 ms 2560 KB
02-medium-05.txt AC 4 ms 2688 KB
02-medium-06.txt AC 4 ms 2688 KB
02-medium-07.txt AC 4 ms 2688 KB
02-medium-08.txt AC 4 ms 2688 KB
02-medium-09.txt AC 4 ms 2688 KB
02-medium-10.txt AC 4 ms 2688 KB
11-large-01.txt AC 98 ms 9216 KB
11-large-02.txt AC 104 ms 9600 KB
11-large-03.txt AC 126 ms 10880 KB
21-biased-01.txt AC 109 ms 9088 KB
21-biased-02.txt AC 119 ms 9600 KB
21-biased-03.txt AC 72 ms 7040 KB
31-uni-01.txt AC 46 ms 3968 KB
31-uni-02.txt AC 48 ms 4096 KB
31-uni-03.txt AC 56 ms 4352 KB
41-distinct-01.txt AC 135 ms 13696 KB
41-distinct-02.txt AC 157 ms 15232 KB
41-distinct-03.txt AC 223 ms 17920 KB
51-min-01.txt AC 4 ms 2560 KB
52-max-01.txt AC 167 ms 13312 KB
52-max-02.txt AC 167 ms 13312 KB
52-max-03.txt AC 168 ms 13312 KB
61-sqrt-01.txt AC 66 ms 4352 KB