Open cup #2
Posted Aragaki
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Open cup #2相关的知识,希望对你有一定的参考价值。
A
D:用前面的H去消去后面的K 然后求最长连续的M
F:在每一列/行里面求最大的数然后组成最大的和ans[]里的比求出最大的
L:并查集
J:DP背锅题 01背包 先求出M种里每种的size和last然后先last最大的放在最后 然后背包DP
long long solve(Group* groups) { long long* x = new long long[n + 1]; for (int i=0; i<n+1; i++) x[i] = INFINITY; x[0] = 0; // all groups but the last; the last always goes // into "last" bus for (int i=0; i<m-1; i++) for (int j=n-groups[i].size; j>=0; j--) { long long time = max(x[j], groups[i].time); x[j+groups[i].size] = min(time, x[j+groups[i].size]); } //for (int i=0; i<=n; i++) cout << x[i] << " "; //cout << endl; long long answer = -1; for (int i=0; i<=k; i++) if (n - i <= k) if (x[i] < INFINITY) { long long total = x[i] * i + (n - i) * groups[m-1].time; if (answer == -1 || total < answer) answer = total; } return answer; }
X[i]表示有i人在一个飞机上时的最小last
然后i从0枚举到k如果剩下的不大于K就统计total 更新答案
以上是关于Open cup #2的主要内容,如果未能解决你的问题,请参考以下文章
VK CUP 2017 CString Reconstruction
XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 P
XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 P
XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 P
XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 P
XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 P