月份:2016年8月

REPORT POJ2993/2996

REPORT POJ2993/2996

POJ 2993:http://poj.org/problem?id=2996
POJ 2996:http://poj.org/problem?id=2996

//=====================================
两道单纯的字符/字符串处理题,就是很麻烦
自己代码写的太丑就转载别人的吧= =
//=====================================

//POJ 2993
#include<iostream>
#include<string>
using namespace std;

class whit
{
public:
	int row;
	char col;
	char pie;
}ww[16];

class blac
{
public:
	int row;
	char col;
	char pie;
}bb[16];

int main(void)
{
	char white[63],black[63];
	gets(white);
	gets(black);

	int x,y,z,r;

	int count_w=0;
	int count_b=0;
	const int length_w=strlen(white);
	const int length_b=strlen(black);

	for(x=7,y=0;x<length_w;)
		if(white[x]>='B' && white[x]<='R')
		{
			ww[y].pie=white[x];
			ww[y].col=white[x+1];
			ww[y].row=white[x+2]-'0';
			y++;
			x+=4;
			count_w++;
		}
		else if(white[x]>='a' && white[x]<='h')
		{
			ww[y].pie='P';
			ww[y].col=white[x];
			ww[y].row=white[x+1]-'0';
			y++;
			x+=3;
		    count_w++;
		}
		else
			break;

		for(x=7,y=0;x<length_b;)
		if(black[x]>='B' && black[x]<='R')
		{
			bb[y].pie=black[x]+32;
			bb[y].col=black[x+1];
			bb[y].row=black[x+2]-'0';
			y++;
			x+=4;
			count_b++;
		}
		else if(black[x]>='a' && black[x]<='h')
		{
			bb[y].pie='p';
			bb[y].col=black[x];
			bb[y].row=black[x+1]-'0';
			y++;
			x+=3;
		    count_b++;
		}
		else
			break;

		char chess[9]['i'];

		memset(chess,':',sizeof(chess));

		for(x=1;x<=7;x+=2)
			for(y='a';y<='g';y+=2)
				chess[x][y]='.';
		for(x=2;x<=8;x+=2)
			for(y='b';y<='h';y+=2)
				chess[x][y]='.';

		for(x=0;x<count_w;x++)
			chess[9-ww[x].row][ww[x].col]=ww[x].pie;

		for(x=0;x<count_b;x++)
			chess[9-bb[x].row][bb[x].col]=bb[x].pie;

		cout<<"+---+---+---+---+---+---+---+---+"<<endl;
		
		for(x=1,r=2;x<=7;x+=2,r+=2)
		{
			cout<<'|';
			for(y='a',z='b';y<='g';y+=2,z+=2)
				cout<<"."<<chess[x][y]<<".|:"<<chess[x][z]<<":|";
			cout<<endl;
			cout<<"+---+---+---+---+---+---+---+---+"<<endl;
			cout<<'|';
			for(y='a',z='b';y<='g';y+=2,z+=2)
				cout<<":"<<chess[r][y]<<":|."<<chess[r][z]<<".|";
			cout<<endl;
			cout<<"+---+---+---+---+---+---+---+---+"<<endl;
		}

	return 0;
}
POJ2996
#include<iostream>  
using namespace std;  
  
class white_piece  
{  
public:  
    int row;  
    char col;  
    bool flag;
}K,Q,R[3],B[3],N[3];  
  
bool pawn[9]['i']={false};
int PR=0,PB=0,PN=0;
  
class black_piece  
{  
public:  
    int row;  
    char col;  
    bool flag;  
}k,q,r[2],b[2],n[2],p[8];  
  
int pr=0,pb=0,pn=0,pp=0;    
  
char chess[9]['i'];
int x,z;  
char y;  
int w_count=0;
int b_count=0;
  
void judge()  
{  
    if(chess[x][y]=='.' || chess[x][y]==':')  
        return;  
    else if(chess[x][y]=='k')
    {  
        k.row=9-x;  
        k.col=y;  
        k.flag=true;  
        b_count++;  
        return;  
    }  
    else if(chess[x][y]=='q')  
    {  
        q.row=9-x;  
        q.col=y;  
        q.flag=true;  
        b_count++;  
        return;  
    }  
    else if(chess[x][y]=='r')  
    {  
        r[pr].row=9-x;  
        r[pr++].col=y;  
        b_count++;  
        return;  
    }  
    else if(chess[x][y]=='b')  
    {  
        b[pb].row=9-x;  
        b[pb++].col=y;  
        b_count++;  
        return;  
    }  
    else if(chess[x][y]=='n')  
    {  
        n[pn].row=9-x;  
        n[pn++].col=y;  
        b_count++;  
        return;  
    }  
    else if(chess[x][y]=='p')  
    {  
        p[pp].row=9-x;  
        p[pp++].col=y;  
        b_count++;  
        return;  
    }  
    else if(chess[x][y]=='K')
    {  
        K.row=9-x;  
        K.col=y;  
        K.flag=true;  
        w_count++;  
        return;  
    }  
    else if(chess[x][y]=='Q')  
    {  
        Q.row=9-x;  
        Q.col=y;  
        Q.flag=true;  
        w_count++;  
        return;  
    }  
    else if(chess[x][y]=='R')  
    {  
        R[PR].row=9-x;  
        R[PR++].col=y;  
        w_count++;  
        return;  
    }  
    else if(chess[x][y]=='B')  
    {  
        B[PB].row=9-x;  
        B[PB++].col=y;  
        w_count++;  
        return;  
    }  
    else if(chess[x][y]=='N')  
    {  
        N[PN].row=9-x;  
        N[PN++].col=y;  
        w_count++;  
        return;  
    }  
    else if(chess[x][y]=='P')  
    {  
        pawn[9-x][y]=true;  
        w_count++;  
        return;  
    }  
}  
  
void Print(void)  
{  
    cout<<"White: ";  
    if(K.flag)  
    {  
        cout<<'K'<<K.col<<K.row;  
        if(--w_count>0)  
            cout<<',';  
    }  
    if(Q.flag)  
    {  
        cout<<'Q'<<Q.col<<Q.row;  
        if(--w_count>0)  
            cout<<',';  
    }  
  
    if(PR==2)  
        if(R[1].row<R[0].row)  
        {  
            R[2]=R[0];  
            R[0]=R[1];  
            R[1]=R[2];  
        }  
    for(x=0;x<PR;x++)  
    {  
        cout<<'R'<<R[x].col<<R[x].row;  
        if(--w_count>0)  
            cout<<',';  
    }  
  
    if(PB==2)  
        if(B[1].row<B[0].row)  
        {  
            B[2]=B[0];  
            B[0]=B[1];  
            B[1]=B[2];  
        }  
    for(x=0;x<PB;x++)  
    {  
        cout<<"B"<<B[x].col<<B[x].row;  
        if(--w_count>0)  
            cout<<',';  
    }  
  
    if(PN==2)  
        if(N[1].row<N[0].row)  
        {  
            N[2]=N[0];  
            N[0]=N[1];  
            N[1]=N[2];  
        }  
    for(x=0;x<PN;x++)  
    {  
        cout<<'N'<<N[x].col<<N[x].row;  
        if(--w_count>0)  
            cout<<',';  
    }  
  
    for(x=1;x<=8;x++)  
        for(y='a';y<='h';y++)  
            if(pawn[x][y])  
            {  
                cout<<y<<x;  
                if(--w_count>0)  
                    cout<<',';  
            }  
      
    cout<<endl;  
  
    cout<<"Black: ";  
    if(k.flag)  
    {  
        cout<<'K'<<k.col<<k.row;  
        if(--b_count>0)  
            cout<<',';  
    }  
    if(q.flag)  
    {  
        cout<<'Q'<<q.col<<q.row;  
        if(--b_count>0)  
            cout<<',';  
    }  
    for(x=0;x<pr;x++)  
    {  
        cout<<'R'<<r[x].col<<r[x].row;  
        if(--b_count>0)  
            cout<<',';  
    }  
    for(x=0;x<pb;x++)  
    {  
        cout<<"B"<<b[x].col<<b[x].row;  
        if(--b_count>0)  
            cout<<',';  
    }  
    for(x=0;x<pn;x++)  
    {  
        cout<<'N'<<n[x].col<<n[x].row;  
        if(--b_count>0)  
            cout<<',';  
    }  
    for(x=0;x<pp;x++)  
    {  
        cout<<p[x].col<<p[x].row;  
        if(--b_count>0)  
            cout<<',';  
    }  
  
    cout<<endl;  
  
    return;  
}  
  
int main()  
{  
    char temp;  

    for(z=0;z<33;z++)  
        cin>>temp;  
  
    for(x=1;x<=8;x++)  
    {  
        cin>>temp;  
        for(y='a';y<='h';y++)  
        {  
            cin>>temp>>chess[x][y]>>temp>>temp;  
            judge();  
        }  
        for(z=0;z<33;z++)  
            cin>>temp;  
    }  

    Print();  
    return 0;  
}  
REPORT POJ1573-Robot Motion

REPORT POJ1573-Robot Motion

Robot Motion
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 12943 Accepted: 6271
Description

A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions are

N north (up the page)
S south (down the page)
E east (to the right on the page)
W west (to the left on the page)

For example, suppose the robot starts on the north (top) side of Grid 1 and starts south (down). The path the robot follows is shown. The robot goes through 10 instructions in the grid before leaving the grid.

Compare what happens in Grid 2: the robot goes through 3 instructions only once, and then starts a loop through 8 instructions, and never exits.

You are to write a program that determines how long it takes a robot to get out of the grid or how the robot loops around.
Input

There will be one or more grids for robots to navigate. The data for each is in the following form. On the first line are three integers separated by blanks: the number of rows in the grid, the number of columns in the grid, and the number of the column in which the robot enters from the north. The possible entry columns are numbered starting with one at the left. Then come the rows of the direction instructions. Each grid will have at least one and at most 10 rows and columns of instructions. The lines of instructions contain only the characters N, S, E, or W with no blanks. The end of input is indicated by a row containing 0 0 0.
Output

For each grid in the input there is one line of output. Either the robot follows a certain number of instructions and exits the grid on any one the four sides or else the robot follows the instructions on a certain number of locations once, and then the instructions on some number of locations repeatedly. The sample input below corresponds to the two grids above and illustrates the two forms of output. The word “step” is always immediately followed by “(s)” whether or not the number before it is 1.
Sample Input

3 6 5
NEESWE
WWWESS
SNWWWW
4 5 1
SESWE
EESNW
NWEEN
EWSEN
0 0 0
Sample Output

10 step(s) to exit
3 step(s) before a loop of 8 step(s)
Source

Mid-Central USA 1999

//============================================
简单模拟
//============================================

#include <iostream>
using namespace std;
int main()
{
	while (true)
	{
		int a, b, p;
		cin >> a >> b >> p;
		if (a == 0 && b == 0 && p == 0) break;
		char s[11][11];
		int s_step[11][11] = { 0 };
		bool iscircle = false;
		for (int i = 0; i<a; i++)
			for (int j = 0; j<b; j++)
			{
				cin >> s[i][j];
			}
		int currentstep = 1;
		int currenti = 0, currentj = p - 1;
		while (true)
		{
			s_step[currenti][currentj] = currentstep;
			switch (s[currenti][currentj])
			{
			case 'N':currenti--; break;
			case 'S':currenti++; break;
			case 'E':currentj++; break;
			case 'W':currentj--; break;
			}
			if (currenti<0 || currentj<0 || currenti >= a || currentj >= b)
			{
				break;
			}
			if (s_step[currenti][currentj] != 0)
			{
				iscircle = true;
				break;
			}
			currentstep++;
		}
		if (iscircle)
			cout << s_step[currenti][currentj] - 1 << " step(s) before a loop of " << currentstep - s_step[currenti][currentj] + 1 << " step(s)" << endl;
		else
			cout << currentstep << " step(s) to exit" << endl;
	}
	return 0;
}
REPORT POJ1068-Parencodings

REPORT POJ1068-Parencodings

Parencodings
Time Limit: 1000MS Memory Limit: 10000K
Total Submissions: 24906 Accepted: 14679
Problem Description
Let S = s1 s2 … s2n be a well-formed string of parentheses. S can be encoded in two different ways: [ul] [li]By an integer sequence P = p1 p2 … pn where pi is the number of left parentheses before the ith right parenthesis in S (P-sequence).[/li] [li]By an integer sequence W = w1 w2 … wn where for each right parenthesis, say a in S, we associate an integer which is the number of right parentheses counting from the matched left parenthesis of a up to a. (W-sequence).[/li] [/ul] Following is an example of the above encodings: [pre] S (((()()()))) P-sequence 4 5 6666 W-sequence 1 1 1456 [/pre] Write a program to convert P-sequence of a well-formed string to the W-sequence of the same string.

Input
The first line of the input file contains a single integer t (1 t 10), the number of test cases, followed by the input data for each test case. The first line of each test case is an integer n (1 n 20), and the second line is the P-sequence of a well-formed string. It contains n positive integers, separated with blanks, representing the P-sequence.

Output
The output file consists of exactly t lines corresponding to test cases. For each test case, the output line should contain n integers describing the W-sequence of the string corresponding to its given P-sequence.

Sample Input
2 6 4 5 6 6 6 6 9 4 6 6 6 6 8 9 9 9

Sample Output
1 1 1 4 5 6 1 1 2 4 5 1 1 3 9

Source
2001 Asia Regional Teheran
//===============================================
简单模拟
先用p序列求出原始序列然后再推出w序列
//===============================================

#include<iostream>
#include<stack>
using namespace std;

int main()
{
	int t;
	cin >> t;
	for (int times = 0; times<t; times++)
	{
		int l, pos = 1, p_seq[100], o_seq[400], w_seq[100];//0:Left 1:Right
		stack<int> id;
		cin >> l;
		for (int i = 1; i <= l; i++)
			cin >> p_seq[i];
		p_seq[0] = 0;
		for (int i = 1; i <= l; i++)
		{
			int temp = p_seq[i] - p_seq[i - 1];
			for (int j = pos; j <= temp + pos - 1; j++)
				o_seq[j] = 0;
			pos = pos + temp + 1;
			o_seq[pos - 1] = 1;
		}
		int o_len = pos - 1;
		pos = 1;
		for (int i = 1; i <= o_len; i++)
		{
			if (o_seq[i] == 0)
			{
				id.push(i);
			}
			if (o_seq[i] == 1)
			{
				int A = (i - id.top() + 1) / 2;
				w_seq[pos] = A;
				pos++;
				id.pop();
			}
		}
		for (int i = 1; i<l; i++)
		{
			cout << w_seq[i] << " ";
		}
		cout << w_seq[l] << endl;
	}
	return 0;
}
REPORT POJ3295-Tautology

REPORT POJ3295-Tautology

Tautology
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 11984 Accepted: 4560
Description

WFF ‘N PROOF is a logic game played with dice. Each die has six faces representing some subset of the possible symbols K, A, N, C, E, p, q, r, s, t. A Well-formed formula (WFF) is any string of these symbols obeying the following rules:

p, q, r, s, and t are WFFs
if w is a WFF, Nw is a WFF
if w and x are WFFs, Kwx, Awx, Cwx, and Ewx are WFFs.
The meaning of a WFF is defined as follows:
p, q, r, s, and t are logical variables that may take on the value 0 (false) or 1 (true).
K, A, N, C, E mean and, or, not, implies, and equals as defined in the truth table below.
Definitions of K, A, N, C, and E
w x Kwx Awx Nw Cwx Ewx
1 1 1 1 0 1 1
1 0 0 1 0 0 0
0 1 0 1 1 1 0
0 0 0 0 1 1 1
A tautology is a WFF that has value 1 (true) regardless of the values of its variables. For example, ApNp is a tautology because it is true regardless of the value of p. On the other hand, ApNq is not, because it has the value 0 for p=0, q=1.

You must determine whether or not a WFF is a tautology.

Input

Input consists of several test cases. Each test case is a single line containing a WFF with no more than 100 symbols. A line containing 0 follows the last case.

Output

For each test case, output a line containing tautology or not as appropriate.

Sample Input

ApNp
ApNq
0
Sample Output

tautology
not
Source

Waterloo Local Contest, 2006.9.30
//====================================================
题目就是计算给出的式子是不是永真式
那么这就和表达式计算很像了
用一个栈来存,操作数进栈,遇到运算符就出栈运算再入栈
栈可以用c++的STL栈,很方便
然后操作数最多只有五个,枚举一下就好了
//====================================================

#include<iostream>
#include<stack>
#include<string>

const int p[32] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 };
const int q[32] = { 0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1 };
const int r[32] = { 0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,1,1,1,1 };
const int s[32] = { 0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1 };
const int t[32] = { 0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1 };
using namespace std;
int main()
{
	string instr;
	cin >> instr;
	while (instr != "0")
	{
		stack<char> calc;
		int strlen = instr.size();
		bool flag = true;
		for (int c = 0; c<32; c++)
		{
			for (int i = strlen - 1; i >= 0; i--)
			{
				int x, y;
				switch (instr[i])
				{
				case 'p':calc.push(p); break;
				case 'q':calc.push(q); break;
				case 'r':calc.push(r); break;
				case 's':calc.push(s); break;
				case 't':calc.push(t); break;
				case 'K':x = calc.top(); calc.pop();
					y = calc.top(); calc.pop();
					calc.push(x&&y);
					break;
				case 'A':x = calc.top(); calc.pop();
					y = calc.top(); calc.pop();
					calc.push(x || y);
					break;
				case 'N':x = calc.top(); calc.pop();
					calc.push(!x);
					break;
				case 'C':x = calc.top(); calc.pop();
					y = calc.top(); calc.pop();
					calc.push((!x) || y);
					break;
				case 'E':x = calc.top(); calc.pop();
					y = calc.top(); calc.pop();
					calc.push(x == y);
					break;
				}
			}
			if (!calc.top())
			{
				cout << "not" << endl;
				flag = false;
				break;
			}
		}
		if (flag) cout << "tautology" << endl;
		cin >> instr;
	}
	return 0;
}
REPORT POJ2586-Y2K Accounting Bug

REPORT POJ2586-Y2K Accounting Bug

Y2K Accounting Bug
Time Limit: 1000MS

Memory Limit: 65536K
Total Submissions: 13593

Accepted: 6889
Description

Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc.
All what they remember is that MS Inc. posted a surplus or a deficit each month of 1999 and each month when MS Inc. posted surplus, the amount of surplus was s and each month when MS Inc. posted deficit, the deficit was d. They do not remember which or how many months posted surplus or deficit. MS Inc., unlike other companies, posts their earnings for each consecutive 5 months during a year. ACM knows that each of these 8 postings reported a deficit but they do not know how much. The chief accountant is almost sure that MS Inc. was about to post surplus for the entire year of 1999. Almost but not quite.

Write a program, which decides whether MS Inc. suffered a deficit during 1999, or if a surplus for 1999 was possible, what is the maximum amount of surplus that they can post.
Input

Input is a sequence of lines, each containing two positive integers s and d.
Output

For each line of input, output one line containing either a single integer giving the amount of surplus for the entire year, or output Deficit if it is impossible.
Sample Input

59 237
375 743
200000 849694
2500000 8000000

Sample Output

116
28
300612
Deficit

Source

Waterloo local 2000.01.29

//————————————————————-

总结一下这题

1.要重建报表

2.每个月盈亏固定为s和d

3.任意连续五个月为亏损

4.求年最大盈利

//————————————————————-

枚举,因为要满足条件只能是以下五种的一种

SSSSD,SSSSD,SS  D>4S

SSSDD,SSSDD,SS  2D>3S

SSDDD,SSDDD,SS 3D>2S

SDDDD,SDDDD,SD 4D>S

DDDDD,DDDDD,DD 4D<S

按照这五种枚举就好了

//

#include <iostream>  
using namespace std;  
const int m[4]={10,8,6,3};
const int c[4]={1,2,3,4};
  
int main()  
{  
    int s,d,ans;  
    while(cin>>s && cin>>d)  
    {
        ans=0;int max=-INT_MAX;
        if (4*d<s) ans=-1;
        else for (int i=0;i<4;i++)
        {
        	ans=(m[i])*s-(12-m[i])*d;
        	if ((ans>max)&&((c[i])*d>(5-c[i])*s)) max=ans;
        }
        if (max<0) cout<<"Deficit"<<endl;
        else cout<<max<<endl;  
    }  
    return 0;  
}  
ACM-POJ

ACM-POJ

初期:

一.基本算法:
(1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法.
(4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)
二.图算法:
(1)图的深度优先遍历和广度优先遍历.
(2)最短路径算法(dijkstra,bellman-ford,floyd,heap+dijkstra) (poj1860,poj3259,poj1062,poj2253,poj1125,poj2240)
(3)最小生成树算法(prim,kruskal) (poj1789,poj2485,poj1258,poj3026) (4)拓扑排序 (poj1094)
(5)二分图的最大匹配 (匈牙利算法) (poj3041,poj3020) (6)最大流的增广路算法(KM算法). (poj1459,poj3436)
三.数据结构.
(1)串 (poj1035 ,poj3080,poj1936) (2)排序(快排、归并排(与逆序数有关)、堆排) (poj2388,poj2299)
(3)简单并查集的应用. (4)哈希表和二分查找等高效查找法(数的Hash,串的Hash)
(poj3349,poj3274,POJ2151,poj1840,poj2002,poj2503)
(5)哈夫曼树(poj3253) (6)堆 (7)trie树(静态建树、动态建树) (poj2513)
四.简单搜索
(1)深度优先搜索 (poj2488,poj3083,poj3009,poj1321,poj2251)
(2)广度优先搜索(poj3278,poj1426,poj3126,poj3087.poj3414)
(3)简单搜索技巧和剪枝(poj2531,poj1416,poj2676,1129)
五.动态规划
(1)背包问题. (poj1837,poj1276)
(2)型如下表的简单DP(可参考lrj的书 page149):
1.E[j]=opt{D[i]+w(i,j)} (poj3267,poj1836,poj1260,poj2533)
2.E[i,j]=opt{D[i-1,j]+xi,D[i,j-1]+yj,D[i-1][j-1]+zij} (最长公共子序列) (poj3176,poj1080,poj1159)
3.C[i,j]=w[i,j]+opt{C[i,k-1]+C[k,j]}.(最优二分检索树问题)
六.数学
(1)组合数学: 1.加法原理和乘法原理. 2.排列组合. 3.递推关系. (POJ3252,poj1850,poj1019,poj1942)
(2)数论. 1.素数与整除问题 2.进制位. 3.同余模运算. (poj2635, poj3292,poj1845,poj2115)
(3)计算方法. 1.二分法求解单调函数相关知识.(poj3273,poj3258,poj1905,poj3122)
七.计算几何学.
(1)几何公式. (2)叉积和点积的运用(如线段相交的判定,点到线段的距离等). (poj2031,poj1039)
(3)多边型的简单算法(求面积)和相关判定(点在多边型内,多边型是否相交) (poj1408,poj1584)

(4)凸包. (poj2187,poj1113)

中级:

一.基本算法:
(1)C++的标准模版库的应用. (poj3096,poj3007)
(2)较为复杂的模拟题的训练(poj3393,poj1472,poj3371,poj1027,poj2706)
二.图算法:
(1)差分约束系统的建立和求解. (poj1201,poj2983) (2)最小费用最大流(poj2516,poj2516,poj2195)
(3)双连通分量(poj2942) (4)强连通分支及其缩点.(poj2186) (5)图的割边和割点(poj3352)
(6)最小割模型、网络流规约(poj3308, )
三.数据结构.
(1)线段树. (poj2528,poj2828,poj2777,poj2886,poj2750) (2)静态二叉检索树. (poj2482,poj2352)
(3)树状树组(poj1195,poj3321) (4)RMQ. (poj3264,poj3368) (5)并查集的高级应用. (poj1703,2492)
(6)KMP算法. (poj1961,poj2406)
四.搜索
(1)最优化剪枝和可行性剪枝 (2)搜索的技巧和优化 (poj3411,poj1724) (3)记忆化搜索(poj3373,poj1691)
五.动态规划
(1)较为复杂的动态规划(如动态规划解特别的施行商问题等)
(poj1191,poj1054,poj3280,poj2029,poj2948,poj1925,poj3034)
(2)记录状态的动态规划. (POJ3254,poj2411,poj1185) (3)树型动态规划(poj2057,poj1947,poj2486,poj3140)
六.数学
(1)组合数学:
1.容斥原理. 2.抽屉原理. 3.置换群与Polya定理(poj1286,poj2409,poj3270,poj1026). 4.递推关系和母函数.
(2)数学.
1.高斯消元法(poj2947,poj1487, poj2065,poj1166,poj1222) 2.概率问题. (poj3071,poj3440)
3.GCD、扩展的欧几里德(中国剩余定理) (poj3101)
(3)计算方法.
1.0/1分数规划. (poj2976) 2.三分法求解单峰(单谷)的极值. 3.矩阵法(poj3150,poj3422,poj3070)
4.迭代逼近(poj3301)
(4)随机化算法(poj3318,poj2454)
(5)杂题.(poj1870,poj3296,poj3286,poj1095)
七.计算几何学.
(1)坐标离散化.
(2)扫描线算法(例如求矩形的面积和周长并,常和线段树或堆一起使用).
(poj1765,poj1177,poj1151,poj3277,poj2280,poj3004)
(3)多边形的内核(半平面交)(poj3130,poj3335)
(4)几何工具的综合应用.(poj1819,poj1066,poj2043,poj3227,poj2165,poj3429)

高级:

一.基本算法要求:
(1)代码快速写成,精简但不失风格 (poj2525,poj1684,poj1421,poj1048,poj2050,poj3306)
(2)保证正确性和高效性. poj3434
二.图算法:
(1)度限制最小生成树和第K最短路. (poj1639)
(2)最短路,最小生成树,二分图,最大流问题的相关理论(主要是模型建立和求解)
(poj3155, poj2112,poj1966,poj3281,poj1087,poj2289,poj3216,poj2446
(3)最优比率生成树. (poj2728) (4)最小树形图(poj3164) (5)次小生成树. (6)无向图、有向图的最小环
三.数据结构.
(1)trie图的建立和应用. (poj2778)
(2)LCA和RMQ问题(LCA(最近公共祖先问题) 有离线算法(并查集+dfs) 和 在线算法 (RMQ+dfs)).(poj1330)
(3)双端队列和它的应用(维护一个单调的队列,常常在动态规划中起到优化状态转移的目的). (poj2823)
(4)左偏树(可合并堆). (5)后缀树(非常有用的数据结构,也是赛区考题的热点). (poj3415,poj3294)
四.搜索
(1)较麻烦的搜索题目训练(poj1069,poj3322,poj1475,poj1924,poj2049,poj3426)
(2)广搜的状态优化:利用M进制数存储状态、转化为串用hash表判重、按位压缩存储状态、双向广搜、A*算法.
(poj1768,poj1184,poj1872,poj1324,poj2046,poj1482)
(3)深搜的优化:尽量用位运算、一定要加剪枝、函数参数尽可能少、层数不易过大、可以考虑双向搜索或者是轮
换搜索、IDA*算法. (poj3131,poj2870,poj2286)
五.动态规划
(1)需要用数据结构优化的动态规划. (poj2754,poj3378,poj3017) (2)四边形不等式理论. (3)较难的状态DP(poj3133)
六.数学
(1)组合数学. 1.MoBius反演(poj2888,poj2154) 2.偏序关系理论.
(2)博奕论 1.极大极小过程(poj3317,poj1085)
2.Nim问题.
七.计算几何学.
(1)半平面求交(poj3384,poj2540) (2)可视图的建立(poj2966) (3)点集最小圆覆盖. (4)对踵点(poj2079)
八.综合题. (poj3109,poj1478,poj1462,poj2729,poj2048,poj3336,poj3315,poj2148,poj1263)

source:優YoU http://blog.csdn.net/lyy289065406/article/details/6642573