hiho week 195 register

Ended

Participants:264

Verdict:Accepted
Score:100 / 100
Submitted:2018-03-28 12:57:37

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<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
    int m, n;
    cin >> n >> m;
    
    //1: weight, 2:value
    vector<vector<int>> mas(11, vector<int>(11, 0));
    vector<int> weight;
    vector<int> value;
    vector<int> vec(m + 1, -1);
    vec[0] = 0;
    int maxi = 0;
    for (int i = 0; i < n; i++) {
        int a, b;
        cin >> a >> b;
        mas[a][b]++;
    }
    
    for (int i = 1; i <= 10; i++) {
        for (int j = 1; j <= 10; j++) {
            if (mas[i][j] == 0)continue;
            int k = 1;
            while (k <= mas[i][j]) {
                weight.push_back(k*i);
                value.push_back(k*j);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX