锘??xml version="1.0" encoding="utf-8" standalone="yes"?>午夜久久久久久禁播电影,亚洲精品乱码久久久久久自慰,亚洲人成电影网站久久http://m.shnenglu.com/lzmagic/category/9873.html鍗氬 瀹¢棶 鎱庢?鏄庤鯨 絎冭zh-cnThu, 16 Apr 2009 10:41:18 GMTThu, 16 Apr 2009 10:41:18 GMT60poj 1094 Sorting It All Outhttp://m.shnenglu.com/lzmagic/archive/2009/04/12/79730.htmllzmagiclzmagicSun, 12 Apr 2009 15:13:00 GMThttp://m.shnenglu.com/lzmagic/archive/2009/04/12/79730.htmlhttp://m.shnenglu.com/lzmagic/comments/79730.htmlhttp://m.shnenglu.com/lzmagic/archive/2009/04/12/79730.html#Feedback1http://m.shnenglu.com/lzmagic/comments/commentRss/79730.htmlhttp://m.shnenglu.com/lzmagic/services/trackbacks/79730.html    絎竴嬈″緢蹇敤鎷撴墤鎺掑簭鎶婁唬鐮佹暡鍑烘潵錛屾彁浜わ紝wa錛屼粩緇嗗垎鏋愬悗錛屽彂鐜板拷鐣ヤ簡(jiǎn)閲嶅杈圭殑鎯呭喌錛屾彃鍏ヨ竟(u, v)錛屽鏋滃浘g宸茬粡瀛樺湪浜?jiǎn)杈?u,v)錛屽氨涓嶈兘鍐嶅鍔爒鐨勫叆搴︺?br>    寰堝揩鏀硅繃鏉ワ紝鎻愪氦錛岃繕鏄痺a錛屽緢鏃犲錛屼笂緗戠湅鐪嬪ぇ鐗涜瘎璁猴紝鍘熸潵鏄彧瑕佸綋鍓嶈緭鍏ユ暟鎹兘“紜畾鍞竴”錛屽強(qiáng)鏃跺悗闈㈣緭鍏ユ暟鎹?#8220;鏈夌幆”錛屼篃鏄垽瀹氫負(fù)“紜畾鍞竴”銆備篃灝辨槸璇達(dá)紝姣忚緭鍏ヤ竴鏉¤竟錛屽鏋滃垽瀹氭湁緇撴灉錛屽拷鐣ュ悗闈㈣緭鍏ユ暟鎹紝鍗充嬌鍚庨潰杈撳叆鏁版嵁鑳芥敼鍙樼粨鏋溿?br>    鍐嶆敼錛屽啀鎻愪氦錛岃繕鏄痺a錛屽嚑搴︽鏀懼純涔嬶紝榪樻槸鍧氭寔涓嬫潵浜?jiǎn)锛屼笂google鎵懼埆浜轟唬鐮佹潵鍒嗘瀽錛岀粨鏋滃彂閫夊彧瑕佸綋鍓嶈緭鍏ユ暟鎹?#8220;鏈夌幆”錛屽強(qiáng)鏃跺綋鍓嶈緭鍏ユ暟鎹?#8220;涓嶈兘紜畾鍞竴”錛屼篃鏄垽瀹氫負(fù)“鏈夌幆”銆?br>    鎶婂垽瀹氶『搴忔敼榪囧悗錛屾彁浜わ紝緇堜簬ac!!!
    鍛紐~~鐖結(jié)Y涓?#8230;…
#include <iostream>
#include 
<fstream>
#include 
<sstream>
#include 
<string>
#include 
<vector>
#include 
<deque>
#include 
<list>
#include 
<queue>
#include 
<stack>
#include 
<set>
#include 
<map>
#include 
<bitset>
#include 
<iterator>
#include 
<algorithm>
#include 
<numeric>
#include 
<functional>
#include 
<climits>
#include 
<ctime>
#include 
<cstdlib>
#include 
<cctype>
using namespace std;

#define UNSURE 0 // 涓嶈兘紜畾 
#define CYCLED 1 // 瀛樺湪鍥炶礬
#define SORTED 2 // 宸茬粡鎺掑簭

int n;                            // n 錛氶《鐐逛釜鏁?#160;
vector<list<int> > g;           // g 錛氬浘 
vector<int> top;                // top 錛氭嫇鎵戝簭鍒?#160;
vector<int> ins;                // ins 錛氬叆搴?#160;

int Topsort()
{
    
bool unsure(false);
    queue
<int> que;
    vector
<int> cnt(ins.begin(), ins.end());    // 鐢╟nt瀛樺偍ins錛岄伩鍏嶄慨鏀筰ns銆?#160;
    for (int j = 0; j < n; ++j)
        
if (cnt[j] == 0) que.push(j);            // 鍏ュ害涓?鐨勯《鐐瑰叆闃熴?#160;
    int u;
    list
<int>::iterator it;
    top.clear();    
    
while (!que.empty())
    
{
        
if (que.size() != 1) unsure = true;        // 濡傛灉閫夋嫨欏剁偣澶氫綑1涓紝涓嶈兘紜畾銆?#160;
        u = que.front(); que.pop();
        top.push_back(u);
        
for (it = g[u].begin(); it != g[u].end(); ++it)
            
if (--cnt[*it] == 0) que.push(*it);
    }

    
if (top.size() != n) return CYCLED;        // 鍏堝垽鏂槸鍚︽湁鐜紝鍗充嬌涓嶈兘紜畾錛?#160;
    if (unsure) return UNSURE;                // 鍐嶅垽鏂槸鍚︿笉鑳界‘瀹氥?#160;
    return SORTED;         
}


int main()
{
    
int steps, ans;
    
string exp;
    
int m, u, v, i;    
    
    
while (cin >> n >> m, n != 0 || m != 0)    // 2 <= n <= 26
    {
        g.assign(n, list
<int>());
        ins.assign(n, 
0);
        ans 
= UNSURE;
        
for (steps = 0; ans == UNSURE && steps < m; ++steps)
        
{
            cin 
>> exp;
            u 
= int(exp[0- 'A'), v = int(exp[2- 'A');
            
if (find(g[u].begin(), g[u].end(), v) == g[u].end()) // 濡傛灉涓嶅瓨鍦ㄨ竟(u, v)錛屾坊鍔犮?#160;
                g[u].push_back(v), ++ins[v];
            ans 
= Topsort(); 
        }

        
for (i = steps; i < m; ++i) cin >> exp; // 澶勭悊鍓╀笅鏃犵敤鐨勮緭鍏ユ暟鎹?#160;
        
        
if (ans == UNSURE) // Output()
            cout << "Sorted sequence cannot be determined." << endl; 
        
else if (ans == CYCLED)
            cout 
<< "Inconsistency found after " << steps << " relations." << endl;
        
else
        

            cout 
<< "Sorted sequence determined after " << steps << " relations: ";
            
for (i = 0; i < n; i++) cout << char('A' + top[i]);
            cout 
<< "." << endl;
        }
 // end Output()
    }

    system(
"pause");
    
return 0;
}


    ps.絎竴錛岃浠旂粏鐪嬮錛岀浜岋紝榪樻槸瑕佷粩緇嗙湅棰樸?img src ="http://m.shnenglu.com/lzmagic/aggbug/79730.html" width = "1" height = "1" />

lzmagic 2009-04-12 23:13 鍙戣〃璇勮
]]>
poj 1024 Tester Programhttp://m.shnenglu.com/lzmagic/archive/2009/03/19/77107.htmllzmagiclzmagicThu, 19 Mar 2009 00:59:00 GMThttp://m.shnenglu.com/lzmagic/archive/2009/03/19/77107.htmlhttp://m.shnenglu.com/lzmagic/comments/77107.htmlhttp://m.shnenglu.com/lzmagic/archive/2009/03/19/77107.html#Feedback0http://m.shnenglu.com/lzmagic/comments/commentRss/77107.htmlhttp://m.shnenglu.com/lzmagic/services/trackbacks/77107.html
/**
 * (1)姹傚悇鐐瑰埌婧愮偣鐨勬渶灝忔鏁幫紙BFS錛?br> * (2)姹傚悇鐐瑰埌緇堢偣鐨勬渶灝忔鏁幫紙BFS錛?br> * (3)濡傛灉鐐逛笉鏄粰瀹氳礬寰勪笂鐨勭偣錛岄偅涔堬細(xì)璇ョ偣鍒版簮鐐圭殑鏈灝忔鏁幫紜璇ョ偣鍒扮粓鐐圭殑鏈灝忔鏁?lt;緇欏畾璺緞鐨勬鏁幫紝鍚﹀垯緇欏畾璺緞涓嶆槸鍞竴鏈鐭殑
 * (4)濡傛灉涓ょ浉閭?cè)潅筧銆乥涔嬮棿瀛樺湪澧欙紝閭d箞錛歛鍒版簮鐐圭殑鏈灝忔鏁幫紜1錛媌鍒扮粓鐐圭殑鏈灝忔鏁?lt;=緇欏畾璺緞鐨勬鏁?br> *                              鎴栬?nbsp;a鍒扮粓鐐圭殑鏈灝忔鏁幫紜1錛媌鍒版簮鐐圭殑鏈灝忔鏁?lt;=緇欏畾璺緞鐨勬鏁幫紝鍚﹀垯澧欏浣?br> * (5)濡傛灉瀛樺湪鐐逛笉鍙揪錛岃鏄庡瓨鍦ㄥ灝嗚鐐瑰皝闂搗鏉ワ紝鍙互璇佹槑澧欒嚦灝戞湁涓鍧楀浣?br> 
*/
#include 
<iostream>
#include 
<string>
#include 
<queue>
using namespace std;

struct Grid
{
    
bool inpath;    // 鏄惁鏄礬寰勬柟鏍?/span>
    bool uwal;      // 鏄惁鏈変笂澧?/span>
    bool rwal;      // 鏄惁鏈夊彸澧?/span>
    int scnt;       // 鍒版簮鐐規(guī)鏁?/span>
    int dcnt;       // 鍒扮粓鐐規(guī)鏁?/span>
};

int main(int argc, char** argv)
{
    
bool ok;
    
int w, h, cnt, steps;   // 1 <= w, h <= 100
    string path;
    Grid grid[
100][100];
    queue
<pair<intint> > q;

    
int t, x, y, desx, desy, x2, y2, i;
    
for (cin >> t; t > 0--t)
    {
        
// 鍒濆鍖栨暟鎹?/span>
        cin >> w >> h;
        
for (y = 0; y < h; ++y)
            
for (x = 0; x < w; ++x)
            {
                grid[y][x].inpath 
= false;
                grid[y][x].uwal 
= false;
                grid[y][x].rwal 
= false;
                grid[y][x].scnt 
= -1;
                grid[y][x].dcnt 
= -1;
            }
        cin 
>> path;
        x 
= 0, y = 0;
        grid[
0][0].inpath = true;
        steps 
= path.size();
        
for (i = 0; i < steps; ++i)
        {
            
switch(path[i])
            {
                
case 'U'++y; break;
                
case 'D'--y; break;
                
case 'L'--x; break;
                
case 'R'++x; break;
            }
            grid[y][x].inpath 
= true;
        }
        desx 
= x, desy = y;
        cin 
>> cnt;
        
for (i = 0; i < cnt; ++i)
        {
            cin 
>> x >> y >> x2 >> y2;
            
if (x == x2)
                
if (y + 1 == y2) grid[y][x].uwal = true;
                
else grid[y2][x].uwal = true;
            
else
                
if (x + 1 == x2) grid[y][x].rwal = true;
                
else grid[y][x2].rwal = true;
        }

        
// 姹傚悇鐐瑰埌婧愮偣鐨勬渶灝忔鏁幫紙BFS錛?/span>
        q.push(make_pair(00));
        grid[
0][0].scnt = 0;
        
while (!q.empty())
        {
            y 
= q.front().first, x = q.front().second;
            
if (y < h - 1 && grid[y][x].uwal == false && grid[y + 1][x].scnt == -1)
            {
                grid[y 
+ 1][x].scnt = grid[y][x].scnt + 1;
                q.push(make_pair(y 
+ 1, x));
            }
            
if (0 < y && grid[y - 1][x].uwal == false && grid[y - 1][x].scnt == -1)
            {
                grid[y 
- 1][x].scnt = grid[y][x].scnt + 1;
                q.push(make_pair(y 
- 1, x));
            }
            
if (0 < x && grid[y][x - 1].rwal == false && grid[y][x - 1].scnt == -1)
            {
                grid[y][x 
- 1].scnt = grid[y][x].scnt + 1;
                q.push(make_pair(y, x 
- 1));
            }
            
if (x < w - 1 && grid[y][x].rwal == false && grid[y][x + 1].scnt == -1)
            {
                grid[y][x 
+ 1].scnt = grid[y][x].scnt + 1;
                q.push(make_pair(y, x 
+ 1));
            }
            q.pop();
        }

        
// 姹傚悇鐐瑰埌緇堢偣鐨勬渶灝忔鏁幫紙BFS錛?/span>
        q.push(make_pair(desy, desx));
        grid[desy][desx].dcnt 
= 0;
        
while (!q.empty())
        {
            y 
= q.front().first, x = q.front().second;
            
if (y < h - 1 && grid[y][x].uwal == false && grid[y + 1][x].dcnt == -1)
            {
                grid[y 
+ 1][x].dcnt = grid[y][x].dcnt + 1;
                q.push(make_pair(y 
+ 1, x));
            }
            
if (0 < y && grid[y - 1][x].uwal == false && grid[y - 1][x].dcnt == -1)
            {
                grid[y 
- 1][x].dcnt = grid[y][x].dcnt + 1;
                q.push(make_pair(y 
- 1, x));
            }
            
if (0 < x && grid[y][x - 1].rwal == false && grid[y][x - 1].dcnt == -1)
            {
                grid[y][x 
- 1].dcnt = grid[y][x].dcnt + 1;
                q.push(make_pair(y, x 
- 1));
            }
            
if (x < w - 1 && grid[y][x].rwal == false && grid[y][x + 1].dcnt == -1)
            {
                grid[y][x 
+ 1].dcnt = grid[y][x].dcnt + 1;
                q.push(make_pair(y, x 
+ 1));
            }
            q.pop();
        }

        
// 鍒ゆ柇璺緞鏄惁鍞竴鏈鐭紝浠ュ強(qiáng)澧欐槸鍚﹀浣?/span>
        ok = true;
        
for (y = 0; y < h && ok; ++y)
            
for (x = 0; x < w && ok; ++x)
            {
                
if (grid[y][x].scnt == -1 || grid[y][x].dcnt == -1)
                    ok 
= false;     // 鏄惁鏈夊皝闂尯鍩?/span>
                if (y < h - 1 && grid[y][x].uwal
                        
&& grid[y][x].scnt + grid[y + 1][x].dcnt + 1 > steps
                        
&& grid[y][x].dcnt + grid[y + 1][x].scnt + 1 > steps)
                    ok 
= false;     // 鏄惁涓婂澶氫綑
                if (x < w - 1 && grid[y][x].rwal
                        
&& grid[y][x].scnt + grid[y][x + 1].dcnt + 1 > steps
                        
&& grid[y][x].dcnt + grid[y][x + 1].scnt + 1 > steps)
                    ok 
= false;     // 鏄惁鍙沖澶氫綑
                if (!grid[y][x].inpath && grid[y][x].scnt + grid[y][x].dcnt <= steps)
                    ok 
= false;     // 鏄惁瀛樺湪鏇寸煭璺緞鎴栧彟涓鏈鐭礬寰?/span>
            }
        
if(ok) cout << "CORRECT" << endl;
        
else cout << "INCORRECT" << endl;
    }

    
return 0;
}





lzmagic 2009-03-19 08:59 鍙戣〃璇勮
]]>
poj 1022 Packing Unit 4D Cubeshttp://m.shnenglu.com/lzmagic/archive/2009/03/18/76984.htmllzmagiclzmagicWed, 18 Mar 2009 04:04:00 GMThttp://m.shnenglu.com/lzmagic/archive/2009/03/18/76984.htmlhttp://m.shnenglu.com/lzmagic/comments/76984.htmlhttp://m.shnenglu.com/lzmagic/archive/2009/03/18/76984.html#Feedback1http://m.shnenglu.com/lzmagic/comments/commentRss/76984.htmlhttp://m.shnenglu.com/lzmagic/services/trackbacks/76984.html/**
 * FloodFill綆楁硶錛屾繁搴﹂亶鍘嗘悳绱€?br> 
*/
#include 
<iostream>
#include 
<map>
using namespace std;

struct Cube
{
    
bool used;          // 鏄惁宸茬粡浣跨敤
    int cood[4];        // 鍧愭爣
    int neighbor[4][2]; // 鐩擱偦鏍囪瘑鍙?/span>
};

void FloodFill(int row, int cnt, Cube *cube, int maxmin[4][2])
{
    
if (cube[row].used == false)
    {
        cube[row].used 
= true;

        
int i, j, k, row2;
        
for (i = 0; i < 4++i)
            
for (j = 0; j < 2++j)
                
if (cube[row].neighbor[i][j] != -1 && cube[cube[row].neighbor[i][j]].used == false)
                {
                    row2 
= cube[row].neighbor[i][j];
                    
for (k = 0; k < 4++k)
                        cube[row2].cood[k] 
= cube[row].cood[k];
                    
if (j == 0)
                    {
                        
++cube[row2].cood[i];
                        
if (maxmin[i][0< cube[row2].cood[i])
                            maxmin[i][
0= cube[row2].cood[i];
                    }
                    
else
                    {
                        
--cube[row2].cood[i];
                        
if (maxmin[i][1> cube[row2].cood[i])
                            maxmin[i][
1= cube[row2].cood[i];
                    }
                    FloodFill(row2, cnt, cube, maxmin);
                }
    }
}

int main(int argc, char** argv) {

    
bool ok;
    
int cnt;    // 1 <= cnt <= 100
    int maxmin[4][2];
    
int minv;
    Cube cube[
100];
    map 
<intint> idmap;

    
int t, i, j, k, id;
    
for (cin >> t; t > 0--t)
    {
        
// 杈撳叆鏁版嵁
        cin >> cnt;
        idmap.clear();
        
for (i = 0; i < cnt; ++i)
        {
            cube[i].used 
= false;
            cin 
>> id;
            idmap[id] 
= i;
            
for (j = 0; j < 4++j)
                
for (k = 0; k < 2++k)
                    cin 
>> cube[i].neighbor[j][k];
        }

        
// 鏍囪瘑鍙鋒敼涓哄搴旂殑琛屽彿
        for (i = 0; i < cnt; ++i)
            
for (j = 0; j < 4++j)
                
for (k = 0; k < 2++k)
                    cube[i].neighbor[j][k] 
= (cube[i].neighbor[j][k] == 0? -1 : idmap[cube[i].neighbor[j][k]];

        
// 鍒ゆ柇鏄惁瀵圭О
        ok = true;
        
for (i = 0; i < cnt && ok; ++i)
            
for (j = 0; j < 4 && ok; ++j)
                
for (k = 0; k < 2 && ok; ++k)
                    
if (cube[i].neighbor[j][k] != -1 && cube[cube[i].neighbor[j][k]].neighbor[j][1 - k] != i)
                        ok 
= false;
        
if (!ok)
        {
            cout 
<< "Inconsistent" << endl;
            
continue;
        }

        
// Flood Fill 綆楁硶 (縐嶅瓙鏌撹壊娉?
        for (i = 0; i < 4++i) cube[i].cood[i] = 0;
        
for (i = 0; i < 4++i) maxmin[i][0= maxmin[i][1= 0;
        FloodFill(
0, cnt, cube, maxmin);

        
// 鍒ゆ柇鏄惁榪為?/span>
        ok = true;
        
for (i = 0; i < cnt && ok; ++i)
            
if (cube[i].used == false)
                ok 
= false;
        
if (!ok)
        {
            cout 
<< "Inconsistent" << endl;
            
continue;
        }

        
// 璁$畻鏈灝忎綋縐?/span>
        minv = 1;
        
for (i = 0; i < 4++i)
            minv 
*= maxmin[i][0- maxmin[i][1+ 1;
        cout 
<< minv << endl;
    }
    
return 0;
}

嫻嬭瘯鏁版嵁錛?br>Input:
6
9
1 2 3 4 5 6 7 8 9
2 0 1 0 0 0 0 0 0
3 1 0 0 0 0 0 0 0
4 0 0 0 1 0 0 0 0
5 0 0 1 0 0 0 0 0
6 0 0 0 0 0 1 0 0
7 0 0 0 0 1 0 0 0
8 0 0 0 0 0 0 0 1
9 0 0 0 0 0 0 1 0
2
3 0 0 1 0 0 0 0 0
1 0 0 3 0 0 0 0 0
4
1 2 0 0 0 0 0 0 0
2 0 1 0 0 0 0 0 0
3 0 0 4 0 0 0 0 0
4 0 0 0 3 0 0 0 0
5
101 2 0 0 0 0 0 0 0
2 0 101 321 0 0 0 0 0
321 4 0 0 2 0 0 0 0
4 5 321 0 0 0 0 0 0
5 0 4 0 0 0 0 0 0
1
10 0 0 0 0 0 0 0 0
4
1 0 2 4 0 0 0 0 0
2 1 0 3 0 0 0 0 0
3 4 0 0 2 0 0 0 0
4 0 3 0 1 0 0 0 0

Output:
81
Inconsistent
Inconsistent
8
1
4



lzmagic 2009-03-18 12:04 鍙戣〃璇勮
]]>
天天躁日日躁狠狠久久| 日本福利片国产午夜久久| 亚洲国产精品无码久久SM| 好久久免费视频高清| 久久综合九色综合欧美就去吻| 久久久久久久久66精品片| 精品久久久中文字幕人妻| 国产毛片久久久久久国产毛片 | 亚洲精品美女久久久久99小说| 国产成人久久精品区一区二区| 狠狠色伊人久久精品综合网| 热re99久久6国产精品免费| 中文精品99久久国产 | 免费无码国产欧美久久18| 久久久久久青草大香综合精品| 国产精品综合久久第一页| 久久精品成人| 亚洲午夜精品久久久久久浪潮 | 一级女性全黄久久生活片免费 | 久久线看观看精品香蕉国产| 国产亚洲精久久久久久无码AV| 久久国产热精品波多野结衣AV| av无码久久久久不卡免费网站| 欧美黑人又粗又大久久久| 狠狠色丁香久久婷婷综合五月| 国产亚洲美女精品久久久| 久久久精品人妻一区二区三区蜜桃| 日本国产精品久久| 精品久久香蕉国产线看观看亚洲| 国产精品免费久久| 麻豆一区二区99久久久久| 久久精品视屏| 精品久久久久久久久午夜福利| 久久九九免费高清视频| 欧美熟妇另类久久久久久不卡| 国产精品嫩草影院久久| 亚洲国产美女精品久久久久∴| 亚洲国产精品一区二区三区久久| 久久久久波多野结衣高潮| 无夜精品久久久久久| 精品久久久久久无码人妻热|