Skip to content

Commit

Permalink
update max_n
Browse files Browse the repository at this point in the history
  • Loading branch information
Sosuke23 committed Jan 21, 2025
1 parent b728b04 commit 7eb5c96
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions solutions/silver/cf-1077D.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ Once it is calculated, construct the resulting array by including elements in pr
#include <iostream>
#include <vector>

const int MAX_N = 200001;
const int MAX_N = 200000;

int main() {
int n, k;
std::cin >> n >> k;
std::vector<int> freq(MAX_N);
std::vector<int> freq(MAX_N + 1);
std::vector<int> res;
for (int i = 0; i < n; i++) {
int x;
Expand All @@ -39,7 +39,7 @@ int main() {

std::function<bool(int)> can = [&](int x) {
int ele_num = 0;
for (int i = 1; i < MAX_N; i++) { ele_num += freq[i] / x; }
for (int i = 1; i <= MAX_N; i++) { ele_num += freq[i] / x; }
return (ele_num >= k);
};

Expand All @@ -53,7 +53,7 @@ int main() {
}
}

for (int i = 1; i < MAX_N; i++) {
for (int i = 1; i <= MAX_N; i++) {
for (int j = 0; j < freq[i] / lo; j++) { res.push_back(i); }
}

Expand All @@ -65,13 +65,13 @@ int main() {
<PySection>

```py
MAX_N = 200001
freq = [0] * (MAX_N)
MAX_N = 200000
freq = [0] * (MAX_N + 1)


def can(x: int) -> bool:
ele_num = 0
for i in range(1, MAX_N):
for i in range(1, MAX_N + 1):
ele_num += freq[i] // x

return ele_num >= k
Expand All @@ -94,7 +94,7 @@ while lo < hi:
else:
hi = mid - 1

for i in range(1, MAX_N):
for i in range(1, MAX_N + 1):
for j in range(0, freq[i] // lo):
res.append(i)

Expand Down

0 comments on commit 7eb5c96

Please sign in to comment.