Merge branch 'master' of https://git.puffypony.party/segcolt/beecrowd-solutions
This commit is contained in:
commit
fa3af48426
@ -96,21 +96,40 @@ int main()
|
|||||||
total += cards.back();
|
total += cards.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmax = max(cards[0], total / p);
|
|
||||||
|
|
||||||
int amax = 0;
|
int amax = 0;
|
||||||
|
int cmax = 1;
|
||||||
|
bool keep = true;
|
||||||
|
for (cmax = 1; keep; cmax++) {
|
||||||
|
amax = 0;
|
||||||
|
size_t pi = 0;
|
||||||
|
size_t i = 0;
|
||||||
int now = 0;
|
int now = 0;
|
||||||
int num = 0;
|
int count = 0;
|
||||||
for (auto i : cards) {
|
for (; i < cards.size() && pi < p; i++) {
|
||||||
if (now + i > cmax) {
|
if (now + cards[i] > cmax) {
|
||||||
now = i;
|
if (now == 0) {
|
||||||
num = 1;
|
pi = p;
|
||||||
} else {
|
continue;
|
||||||
now += i;
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
rmax(amax, num);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cout << amax << ' ' << cmax << '\n';
|
rmax(amax, count);
|
||||||
|
now = 0;
|
||||||
|
count = 0;
|
||||||
|
pi++;
|
||||||
|
i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
now += cards[i];
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < cards.size()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rmax(amax, count);
|
||||||
|
keep = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
cout << amax << ' ' << cmax - 1 << '\n';
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user