Created
August 1, 2013 23:07
-
-
Save NonWhite/6136152 to your computer and use it in GitHub Desktop.
uva 10171
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| #include <cstdio> | |
| #include <cstring> | |
| #include <string> | |
| #define f( i , a , b ) for(int i = a ; i < b ; i++) | |
| #define TAM 50 | |
| using namespace std ; | |
| int m , n = 30 ; | |
| int Y[ TAM ][ TAM ] ; | |
| int M[ TAM ][ TAM ] ; | |
| void init(){ | |
| f( i , 0 , n ) f( j , 0 , n ) ; | |
| } | |
| ii floyd(){ | |
| } | |
| int main(){ | |
| char A[ 10 ] , D[ 10 ] , izq[ 10 ] , der[ 10 ] ; | |
| int len ; | |
| while( scanf("%d" , &m ) == 1 ){ | |
| if( m == 0 ) break ; | |
| init() ; | |
| f( i , 0 , m ){ | |
| scanf("%s%s%s%s%d" , A , D , izq , der , len ) ; | |
| int x = izq[ 0 ] - 'A' ; | |
| int y = der[ 0 ] - 'A' ; | |
| if( A[ 0 ] == 'Y' ){ | |
| Y[ x ][ y ] = 1 ; | |
| if( D[ 0 ] == 'B' ) Y[ y ][ x ] = 1 ; | |
| }else{ | |
| M[ x ][ y ] = 1 ; | |
| if( D[ 0 ] == 'B' ) M[ y ][ x ] = 1 ; | |
| } | |
| } | |
| ii R = floyd() ; | |
| if( R.first < 0 ) printf("You will never meet.\n" ) ; | |
| else printf("%d %c\n" , R.first , R.second ) ; | |
| } | |
| return 0 ; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment