hiho Week 8 register

Ended

Participants:541

Verdict:Accepted
Score:100 / 100
Submitted:2014-08-24 11:01:31

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>
using std::cin;
using std::cout;
int countmask(int numero){
    int res=0;
    while(numero!=0){
        res+=numero%2;
        numero/=2;
    }
    return res;
}
int main(){
    int len, container, limit;
    cin>>len>>container>>limit;
    int mask=(1<<container)-1;
    std::vector<int> opt(1<<container, 0);
    std::vector<int> cur(1<<container);
    for(int i=0; i!=len; i++){
        int gabbage;
        cin>>gabbage;
        for(int state = 0; state!=1<<container; state++){
            if(countmask(state)>limit){
                cur[state]=0;
            }else{
                int old_state = state>>1;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX