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();
|
||||
}
|
||||
|
||||
int cmax = max(cards[0], total / p);
|
||||
|
||||
int amax = 0;
|
||||
int now = 0;
|
||||
int num = 0;
|
||||
for (auto i : cards) {
|
||||
if (now + i > cmax) {
|
||||
now = i;
|
||||
num = 1;
|
||||
} else {
|
||||
now += i;
|
||||
num++;
|
||||
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 count = 0;
|
||||
for (; i < cards.size() && pi < p; i++) {
|
||||
if (now + cards[i] > cmax) {
|
||||
if (now == 0) {
|
||||
pi = p;
|
||||
continue;
|
||||
}
|
||||
|
||||
rmax(amax, count);
|
||||
now = 0;
|
||||
count = 0;
|
||||
pi++;
|
||||
i--;
|
||||
continue;
|
||||
}
|
||||
|
||||
now += cards[i];
|
||||
count++;
|
||||
}
|
||||
rmax(amax, num);
|
||||
|
||||
if (i < cards.size()) {
|
||||
continue;
|
||||
}
|
||||
rmax(amax, count);
|
||||
keep = false;
|
||||
}
|
||||
|
||||
cout << amax << ' ' << cmax << '\n';
|
||||
cout << amax << ' ' << cmax - 1 << '\n';
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user