hiho week 195 register

Ended

Participants:264

Verdict:Accepted
Score:100 / 100
Submitted:2018-03-31 06:43:08

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>
using namespace std;
int e[100][100];
int w[120000],p[120000];
int w_[1200],p_[1200];
int tot= 0;
int n,m,k,l;
int dp[120000];
int main()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>w[i]>>p[i];
        e[w[i]][p[i]] ++;
    }
    for(int i=1;i<=10;i++)
        for(int j=1;j<=10;j++)
        {
            if(e[i][j] == 0)continue;
            for(int k = 1;e[i][j] >=k;k*=2)
            {
                tot++;
                w_[tot] = i*k;
                p_[tot] = j*k;
                e[i][j] -= k;
            }
            if(e[i][j])
            {
                tot++;
                w_[tot] = e[i][j]*i;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX