hiho week 102 register

Ended

Participants:235

Verdict:Accepted
Score:100 / 100
Submitted:2016-06-15 13:31:51

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 <cstdio>
#include <cstring>
#include <algorithm> 
#include <vector>
 
#define FOR(i,A,s) for(int i=A[s];i!=s;i=A[i])
using namespace std;
 
const int maxnode=3024;
const int maxm=400;
struct DLX{
    int n,sz;
    int S[maxm];
    int L[maxnode],R[maxnode],U[maxnode],
        D[maxnode];
    int row[maxnode],col[maxnode];
    int ansd,ans[maxm*2]; 
         
    void init(int n)
    {
        for(int i=0;i<=n;i++)
        {
            U[i]=i;D[i]=i;L[i]=i-1;R[i]=i+1;    
        }
        R[n]=0;L[0]=n;
        sz=n+1;
        memset(S,0,sizeof(S));
    }
     
    void AddRow(int r,vector<int> clms)
    {
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX