hiho week 83 register

Ended

Participants:67

Verdict:Accepted
Score:100 / 100
Submitted:2016-02-05 01:56:47

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 <iomanip>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
struct Candidate {int v,s,id;};
const int N = 105;
const int B = 1005;
int f[N][N][B],g[N][N][B],p[B];
int f1[N][N][B],g1[N][N][B],p1[B];
int f2[N][N][B],g2[N][N][B],p2[B];
void print(vector<Candidate> &cans,int X,int v,vector<int> &res) {
    int i,j,k;
    i = cans.size();
    j = X;
    k = v;
    // cout << "i =  " << i << " " << X << " " << v << endl;
    for(;j>0;) {
        
        i = g[i][j][k];
        res.push_back(cans[i-1].id);
        // cout << "ID =  " << cans[i-1].id ;
        // cout << " " << i << " " << cans[i-1].s << endl;
        
        j--;
        k -= cans[i-1].s;
        i--;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX