# 1031 -...

This preview shows pages 1–3. Sign up to view the full content.

#include<iostream> #include<cstdio> #include<algorithm> #include<set> #include<vector> using namespace std; enum { SIZ = 104, }; struct Node { int maxnum; set<int> mem; }; int num, val; int matnum, sqnum; set<int> match[SIZ]; Node square[SIZ]; struct myGreater{ return match[a].size() > match[b].size(); } }; inline int getV(int x, int y){ if (x>=num || y>num) return -1; return x*(2*num+1)+y+1+num; } inline int getH(int x, int y){ if (x>num || y>=num) return -1; return x*(2*num+1)+y+1; } void init(){ int i, j, a; for (i=0; i<SIZ; ++i) match[i].clear(); for (i=0; i<SIZ; ++i){ square[i].maxnum = 0; square[i].mem.clear(); } matnum = getH(num, num-1) + 1; sqnum = 0; for (a=0; a<num; ++a){ for (i=0; i+a<num; ++i){ for (j=0; j+a<num; ++j){ int k, t; for (k=0; k<=a; ++k){ // horizonally t = getH(i, j+k); square[sqnum].mem.insert(t); match[t].insert(sqnum); t = getH(i+a+1, j+k); square[sqnum].mem.insert(t); match[t].insert(sqnum); t = getV(i+k, j);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
square[sqnum].mem.insert(t);
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/18/2010 for the course CS 100 taught by Professor Acm during the Spring '10 term at Zhejiang University.

### Page1 / 3

1031 -...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online