谁有北大poj上第1820、2020、2420、2620、2789、2950、3029、3342中任何一题的答案

来源:百度知道 编辑:UC知道 时间:2024/06/08 02:11:46
有的话借偶参考一下,谢谢各位!
1820 : Expression
2020 : MisLED
2420 : A Star not a Tree?
2620 : Minimal coverage
2789 : Pixel Shuffle
2950 : Nuclear Plants
3029 : Tour Guide
3342 : Party at Hali-Bula

Source Code

Problem: 3342 User: Andimeo
Memory: 616K Time: 32MS
Language: G++ Result: Accepted

Source Code
#include<stdio.h>
#include<string.h>
#include<map>
#include<iostream>
#include<string>

using namespace std;

#define ax(a,b) (a>b?a:b)

int tree[201][201];
int n;
int yes[201];
int no[201];
int result;
int color[201];
bool only[201][2];

const int white = 0;
const int gray = 1;
const int black = 2;

map<string,int> my;

void dfs(int i)
{
color[i] = gray;
int j;
bool ok = false;
for(j=1;j<=n;j++)
{
if(!color[j] && tree[i][j])
{
dfs(j);
only[i][0] = only[j][1] && only[i][0];
yes[i] += no[j];
no[i] += ax(yes[j],no[j]);
if(yes[j] == no[j] || yes[j]>no[j] && !only[j][0] || yes[j]<no[j]