[Offer收割]编程练习赛12 register

Ended

Participants:1323

Verdict:Accepted
Score:100 / 100
Submitted:2017-04-02 13:45:11

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 100100;
int C[MAXN];
int cursor[MAXN];
vector<int> width[MAXN];
map<int, int> wmap;
struct Cmp {
    bool operator()(const int& r1, const int& r2) {
        int w1 = width[r1][cursor[r1]];
        int w2 = width[r2][cursor[r2]];
        return w1 > w2;
    }
};
int main() {
  // freopen("input", "r", stdin);
  int N; cin >> N;
  int W = 0;
  for (int i = 0; i < N; i++) {
    cin >> C[i];
    for (int j = 0; j < C[i]; j++) {
        int num; cin >> num;
        if (i == 0) W += num;
        if (width[i].empty()) {
            width[i].push_back(num);
        } else {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX