Problem Description 在一个N*M的地图上旅行.地图上有些地方可以走用. 表示,不能走用 # 表示.在可以走的地方上下左右移动一格需要一个单位时间.可以走的地方还有一些时空之门.时空之门可以减少旅行的时间.如果 A 到 B 有一道时空之门,那么从 A 到 B 经过时空之门只要 1 个单位时间.在一个点可以有很多门通向其他的不同点.现在 john 在 s 点,他想以最快的时间到 t 点.求出最短时间. Input 输入包含多组数据输入数据第一行两个正整数 N M (1< n,m…
Problem 2082 过路费 Problem Description 有n座城市,由n-1条路相连通,使得任意两座城市之间可达.每条路有过路费,要交过路费才能通过.每条路的过路费经常会更新,现问你,当前情况下,从城市a到城市b最少要花多少过路费. Input 有多组样例,每组样例第一行输入两个正整数n,m(2 <= n<=50000,1<=m <= 50000),接下来n-1行,每行3个正整数a b c,(1 <= a,b <= n , a != b , 1…
Problem 2150 Fire Game Accept: 145 Submit: 542 Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid o…
Problem Description Given N integers A={A[0],A[1],...,A[N-1]}. Here we have some operations: Operation 1: AND opn L R Here opn, L and R are integers. For L≤i≤R, we do A[i]=A[i] AND opn (here "AND" is bitwise operation). Operation 2: OR opn L R H…
Problem 2275 Game Accept: 62 Submit: 165Time Limit: 1000 mSec Memory Limit : 262144 KB Problem Description Alice and Bob is playing a game. Each of them has a number. Alice’s number is A, and Bob’s number is B. Each turn, one player can do one…