Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7964 - Roadblock

Every morning, FJ wakes up and walks across the farm from his house to the barn. The farm is a collection of N fields (1 <= N <= 100) connected by M bidirectional pathways (1 <= M <= 10,000), each with an associated length. FJ's house is in field 1, and the barn is in field N. No pair of fields is joined by multiple redundant pathways, and it is possible to travel between any pair of fields in the farm by walking along an appropriate sequence of pathways. When traveling from one field to another, FJ always selects a route consisting of a sequence of pathways having minimum total length. Farmer John's cows, up to no good as always, have decided to interfere with FJ's morning routine. They plan to build a pile of hay bales on exactly one of the M pathways on the farm, doubling its length. The cows wish to select a pathway to block so that they maximize the increase in FJ's distance from the house to the barn. Please help the cows determine by how much they can lengthen FJ's route.

Input

Input description...

Output

Output description...

Example

Input:
etc.

Output:
etc.


Нэмсэн:Bataa
Огноо:2013-12-29
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE
Эх сурвалж:USACO 2011 December Contest, Silver Division

hide comments
2023-03-21 01:07:27
itz hard
2023-03-21 01:07:27
itz hard
2019-12-27 12:56:22
#include <cstdlib>
#include <conio.h>
#include <iostream>
#include <dos.h>
#include <windows.h>
#include <time.h>

using namespace std;

int x , y , i , j , x1 , y1 , x2 , y2 , xx , yy , urt ,urgun , Score , score;
int fruitX , fruitY;
int d , m , s , p;
bool gameover;
char a;
int X[100] , Y[100];

void gotoxy (int x, int y){
COORD coordinates; // coordinates is declared as COORD
coordinates.X = x; // defining x-axis
coordinates.Y = y; //defining y-axis
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coordinates);
}

void Setup() {
p = 100;
s = 100;
m = 2;
a = 195;
d = 2;
x1 = 10;
y1 = 5;
urt = 60;
urgun = 20;
x2 = x1 + urt + 1;
y2 = y1 + urgun + 1;
score = 10;
Score = 0;
x = ( x1 + x2 ) / 2;
y = ( y1 + y2 ) / 2;
X[1] = x - 2;
Y[1] = y;
X[2] = x - 1;
Y[2] = y;
fruitX = rand () % urt + x1 + 1;
fruitY = rand () % urgun + y1 + 1;
x = ( x1 + x2 ) / 2;
y = ( y1 + y2 ) / 2;
gameover=false;
}

void Draw () {
gotoxy ( x2-12 , y1 - 1);
printf ( "Score%5d", Score );

// gotoxy ( x , y );
// printf ( "%c",a );
gotoxy ( X[1] , Y[1] );
printf ( "-" );
gotoxy ( X[2] , Y[2] );
printf ( "o" );
gotoxy ( x , y );
printf ( "%c", a);

gotoxy ( fruitX , fruitY );
printf ( "$" );

gotoxy ( x1 , y1 );
printf ( "%c", 218 );

for ( i = x1 + 1; i < x2; i++ ) {
printf ( "%c", 196 );
}

printf ( "%c", 191 );

for ( j = y1 + 1; j < y2; j++ ) {
gotoxy ( x1 , j );
printf ( "%c", 179 );
gotoxy ( x2 , j );
printf ( "%c", 179 );
}

gotoxy ( x1 , y2 );
printf ( "%c", 192 );

for ( i = x1 + 1; i < x2; i++ ) {
printf ( "%c", 196 );
}

printf ( "%c", 217 );
}
void Game () {
//gotoxy ( x , y );
//printf ( " " );
for ( i = 1; i <= m; i++ ) {
if ( X[i] == x && Y[i] == y ) {
gotoxy ( ( x1 + x2 ) / 2 , ( y1 + y2 ) / 2 );
printf ( "GAMEOVER" );
gameover = true;
gotoxy ( ( x1 + x2 ) / 2 , ( y1 + y2 ) / 2 + 1 );
printf ( "%d",Score );
gotoxy ( x1 + 1 , y2 );
}
}
xx = x;
yy = y;
if ( kbhit() ) {
switch ( getch () ) {
case 72 : {
if ( d != 3 ) d = 1;
break;
}
case 77 : {
if ( d != 4 ) d = 2;
break;
}
case 80 : {
if ( d != 1 ) d = 3;
break;
}
case 75 : {
if ( d != 2 ) d = 4;
break;
}
case 27 : {
gameover = true;
gotoxy ( ( x1 + x2 ) / 2 , ( y1 + y2 ) / 2 );
printf ( "END" );
gotoxy ( ( x1 + x2 ) / 2 , ( y1 + y2 ) / 2 + 1 );
printf ( "%d", Score );
gotoxy ( x1 + 1 , y2 );
break;
}
}
}
switch ( d ) {
case 1 : {
if ( y > y1 + 1) y--;
else y = y2 - 1;
a = 193;
break;
}
case 2 : {
if ( x < x2 - 1 ) x++;
else x = x1 + 1;
a = 195;
break;
}
case 3 : {
if ( y < y2 - 1 ) y++;
else y = y1 + 1;
a = 194;
break;
}
case 4 : {
if ( x > x1 + 1 ) x--;
else x = x2 - 1;
a = 180;
break;
}
}
if ( x == fruitX && y == fruitY ) {
fruitX = rand () % urt + x1 + 1;
fruitY = rand () % urgun + y1 + 1;
gotoxy ( fruitX , fruitY );
printf ( "$" );
Score = Score + score;
gotoxy ( x2 - 7 , y1 - 1);
printf ( "%5d", Score );
m++;
X[m] = xx;
Y[m] = yy;
fruitX = rand() % urt + 1 + x1;
fruitY = rand() % urgun + 1 + y1;
gotoxy ( fruitX , fruitY );
printf ( "$" );
} else {
gotoxy ( X[1] , Y[1] );
printf ( " " );

for ( i = 1; i < m; i++ ) {
X[i] = X[i+1];
Y[i] = Y[i+1];
}
X[m] = xx;
Y[m] = yy;
gotoxy ( X[1] , Y[1] );
printf ( "-" );
gotoxy ( xx , yy );
printf ( "o" );
gotoxy ( x , y );
printf ( "%c",a );
}
gotoxy ( xx , yy );
printf ( "o" );
gotoxy ( x , y );
printf ( "%c", a );
if ( Score == p ) {
s = s - 20;
p = p + 100;
}
if ( s == 0 ) {

}
Sleep ( s );
}

int main() {
Setup();

Draw();

while ( !gameover ) {
Game();
}

return 0;
}
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.