Page 1 of 4

10800 - Not That Kind of Graph

Posted: Thu Jan 13, 2005 3:28 pm
by Eduard
It seems that this problem is very easy but i'm getting WA.Are there any special cases??
Please give me answer to this tests.
Input

Code: Select all

5
RRRCFCRFRFFCCCR
RRR
CCCCCC
CRCFRCFRRFR
CRRRFCFRCFRFC
Thanks.

Posted: Thu Jan 13, 2005 4:12 pm
by sidky
My Program gives this output:

Code: Select all

Case #1:
|    _
|   / \_/\/\
|  /        \___/
| /
+-----------------

Case #2:
|   /
|  /
| /
+-----

Case #3:
| ______
+--------

Case #4:
|   _  _  /\/
| _/ \/ \/
+-------------

Case #5:
|    /\_  _
|   /   \/ \/\_
| _/
+---------------

Also check these inputs

Code: Select all

1
RRRFFFFFFFFFF
whose output is:

Code: Select all

Case #1:
|   /\
|  /  \
| /    \
|       \
|        \
|         \
|          \
|           \
|            \
|             \
+---------------

Good luck.

Posted: Thu Jan 13, 2005 8:24 pm
by Eduard
Thanks sidky for your reply.My program is giving same answer to these inputs, also for your input,but I'm still getting WA.May be you can give some more tests?
Thanks.

Posted: Thu Jan 13, 2005 8:45 pm
by w k
Edouard,

Check for trailing spaces in each line!

Wojciech

Posted: Thu Jan 13, 2005 9:01 pm
by Eduard
Ok I find my mistake and got AC.
Eduard.

Posted: Tue Feb 22, 2005 7:10 pm
by Sedefcho
For anyone who may need some
sample Input / Output on this problem

INPUT

Code: Select all

12
CCCRR
RRRFFFFFFFFFFRRRRRRRRRRRRRRRRRRRRRRRRRRRFFFFFF
RRRFFFFFFFFFF
CCCR
CCCCCCCCCCCCCCCRRCCCCCCCCCCCCCCCRRCCCCCCCCCCCCCCCRRCCCCCCCCCCCCCCCRR
RRRRFFFFRCRFCRFFCCRRC
RRRRRRRRRRRRRRRRRFFFFRCRFCRFFCCRRC
FFFRCCCCFFR
FFFCCCRRFFRRR
FFFCCCRRFFRRRFFFCCCRRFFRRR
CCCCCCCCCCCCCCCRRCCCCCCCCCCCCCCCRRCCCCCCCCCCCCCCCRRCCCCCCCC
RRCCFFCCCCCCCCCCCCCCCRRCCCCCCCCCCCCCCCRRCCCCCCCCCCCCCCCRRCCCCCCCC
OUTPUT

Code: Select all

Case #1:
|     /
| ___/
+-------

Case #2:
|                                        /\
|                                       /  \
|                                      /    \
|                                     /      \
|                                    /        \
|                                   /          \
|                                  /
|                                 /
|                                /
|                               /
|                              /
|                             /
|                            /
|                           /
|                          /
|                         /
|                        /
|   /\                  /
|  /  \                /
| /    \              /
|       \            /
|        \          /
|         \        /
|          \      /
|           \    /
|            \  /
|             \/
+------------------------------------------------

Case #3:
|   /\
|  /  \
| /    \
|       \
|        \
|         \
|          \
|           \
|            \
|             \
+---------------

Case #4:
| ___/
+------

Case #5:
|                                                                    /
|                                                    _______________/
|                                                   /
|                                   _______________/
|                                  /
|                  _______________/
|                 /
| _______________/
+----------------------------------------------------------------------

Case #6:
|    /\
|   /  \              _
|  /    \  _/\_/\    /
| /      \/      \__/
+-----------------------

Case #7:
|                 /\
|                /  \              _
|               /    \  _/\_/\    /
|              /      \/      \__/
|             /
|            /
|           /
|          /
|         /
|        /
|       /
|      /
|     /
|    /
|   /
|  /
| /
+------------------------------------

Case #8:
| \
|  \  ____
|   \/    \
|          \/
+-------------

Case #9:
| \           /
|  \     /\  /
|   \___/  \/
+---------------

Case #10:
| \           /\           /
|  \     /\  /  \     /\  /
|   \___/  \/    \___/  \/
+----------------------------

Case #11:
|                                                    ________
|                                                   /
|                                   _______________/
|                                  /
|                  _______________/
|                 /
| _______________/
+-------------------------------------------------------------

Case #12:
|                                                          ________
|                                                         /
|                                         _______________/
|                                        /
|   __                   _______________/
|  /  \                 /
| /    \_______________/
+-------------------------------------------------------------------


Posted: Tue Feb 22, 2005 7:11 pm
by Sedefcho
That's the output from an ACC program of course.

ummm..... HEEEEELP!!

Posted: Tue Apr 12, 2005 12:26 am
by dootzky
cheers guys, after 10 attempts i got ACCEPTED!!

special thanx goes to Sedefcho, he helped me debug my proggy! :D

cheers,
dootzky

10800 - Not That Kind of Graph

Posted: Sat May 28, 2005 5:01 pm
by Raj Ariyan
Hi,
I'm getting WA several times of this easy problem. Please give me some critical I/O. One question, is there any output like that ---> FFFF.
I dont think so, bcoz "The x-axis should always appear directly below the graph". Then what i miss!!! Thanks in advance.

Posted: Sat May 28, 2005 5:48 pm
by myqbzi

Code: Select all

4
RCRFCRFFCCRRC
FFFCCC
RFCRFC
CCCRRF

Output:

Case #1:
|             _
|  _/\_/\    /
| /      \__/
+---------------

Case #2:
| \
|  \
|   \___
+--------

Case #3:
| /\_/\_
+--------

Case #4:
|     /\
| ___/
+--------

Thanx

Posted: Sat May 28, 2005 6:27 pm
by Raj Ariyan
Hi myqbzi,
Thank You. It really helps me. I missed the second case. Thanx again. Bye.

Posted: Fri Jun 24, 2005 11:22 pm
by Christophoros
hi.

is any tricky case for this problem? It seems very simple , but I'm taking WA.
Please send some more in/out cases.

thx in advance

Posted: Sat Jun 25, 2005 6:10 am
by Raj Ariyan
Hi Christophoros,
I dont think there is any tricky case. But i miss one things when i faced WA. That case was FFFF i means falls at first position. After taking this case i got ACC. The 2nd case of the previous post was really helps me. Here are some cases. Hope it helps. Thanx.

Input :-

Code: Select all

14
FCCCRRCCRRCCCCFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFF
CCRRRRRFFFFFCCCCRRRRRRRFFFFFFFCCCCRRRRRRRRFFFFFFFF
R
C
RRRCCFFF
RRFFCCRRRFFFCCCRRRCCCRRRCC
RFRFRFRFRFRFRFRFRFRFRFRFRF
RCRFCRFFCCRRC
RRRRRRRRRRRRRFFFFFFFFFFFFF
CCRRCCRRCCRRCCRRCCRRCCFFCCFFCCFFCCFFCCFFCC
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCRRRRRFFFFFCCCCRRRRRRRFFFFFFFCCCCRRRRRRRRFFFFFFFF
Output :-

Code: Select all

Case #1:
|           ____
|          /    \
|       __/      \
|      /          \
| \___/            \
+--------------------

Case #2:
| \
|  \
|   \
|    \
|     \
|      \
|       \
|        \
|         \
|          \
|           \
|            \
|             \
|              \
|               \
|                \
|                 \
|                  \
|                   \
|                    \
|                     \
|                      \
|                       \
|                        \
|                         \
|                          \
+----------------------------

Case #3:
|                                          /\
|                       /\                /  \
|                      /  \              /    \
|       /\            /    \            /      \
|      /  \          /      \          /        \
|     /    \        /        \        /          \
|    /      \      /          \      /            \
| __/        \____/            \____/              \
+----------------------------------------------------

Case #4:
| /
+---

Case #5:
| _
+---

Case #6:
|    __
|   /  \
|  /    \
| /      \
+----------

Case #7:
|                         __
|                        /
|                       /
|                   ___/
|         /\       /
|  /\    /  \     /
| /  \__/    \___/
+----------------------------

Case #8:
| /\/\/\/\/\/\/\/\/\/\/\/\/\
+----------------------------

Case #9:
|             _
|  _/\_/\    /
| /      \__/
+---------------

Case #10:
|             /\
|            /  \
|           /    \
|          /      \
|         /        \
|        /          \
|       /            \
|      /              \
|     /                \
|    /                  \
|   /                    \
|  /                      \
| /                        \
+----------------------------

Case #11:
|                     __
|                    /  \
|                 __/    \__
|                /          \
|             __/            \__
|            /                  \
|         __/                    \__
|        /                          \
|     __/                            \__
|    /                                  \
| __/                                    \__
+--------------------------------------------

Case #12:
|                                                  /
|                                                 /
|                                                /
|                                               /
|                                              /
|                                             /
|                                            /
|                                           /
|                                          /
|                                         /
|                                        /
|                                       /
|                                      /
|                                     /
|                                    /
|                                   /
|                                  /
|                                 /
|                                /
|                               /
|                              /
|                             /
|                            /
|                           /
|                          /
|                         /
|                        /
|                       /
|                      /
|                     /
|                    /
|                   /
|                  /
|                 /
|                /
|               /
|              /
|             /
|            /
|           /
|          /
|         /
|        /
|       /
|      /
|     /
|    /
|   /
|  /
| /
+----------------------------------------------------

Case #13:
| __________________________________________________
+----------------------------------------------------

Case #14:
|                                          /\
|                       /\                /  \
|                      /  \              /    \
|       /\            /    \            /      \
|      /  \          /      \          /        \
|     /    \        /        \        /          \
|    /      \      /          \      /            \
| __/        \____/            \____/              \
+----------------------------------------------------


Posted: Sat Jun 25, 2005 3:24 pm
by Christophoros
Thanks for the help Raj.
Still it seems that my code reacts normally. I would apreciate if someone could take a look at my code:

Code: Select all

#include <iostream>
#include <fstream>
using namespace std ;

int main(){
	size_t  l , ln ; 
	char instr[55]={' '} , graph[55][110] = {' '} , line[55]={' '};
 	int cases , nr=1 , i , j , mx , mn ;

//	ifstream cin("in.txt",ios::in) ;

	cin >> cases ; cin.getline(line,55) ;
	while(cases-->0) { cin.getline(line,55) ; l = strlen(line) ; ln = 0 ;

		for(i=0 ; i<l ; ++i)
			if ((line[i]=='C')||(line[i]=='F')||(line[i]=='R')) instr[ln++] = line[i] ;  

		j = 55 ; mx = mn = 0 ;
		if (instr[0]=='R') graph[0][j] = 47 ;
		else if (instr[0]=='C') graph[0][j] = '_' ;
		else if (instr[0]=='F') graph[0][j] = 92  ;

		for(i=1 ; i<ln ; ++i) 

			if (instr[i]=='R') {
				if (instr[i-1]=='R') { 
					j++ ; if (j-55>mx) mx = j-55 ; 
					graph[i][j] = 47 ; }
				else if (instr[i-1]=='C') graph[i][j] = 47 ;
				else if (instr[i-1]=='F') graph[i][j] = 47 ; }

			else if (instr[i]=='C') { 
				if (instr[i-1]=='R') { 
					j++ ; if (j-55>mx) mx = j-55 ; 
					graph[i][j] = '_' ; }
				else if (instr[i-1]=='C') graph[i][j] = '_' ;
				else if (instr[i-1]=='F') graph[i][j] = '_' ; }

			else if (instr[i]=='F') { 
				if (instr[i-1]=='R') graph[i][j] = 92 ;
				else if (instr[i-1]=='C') { 
					--j ; if (j-55<mn) mn = j-55 ;
					graph[i][j] = 92 ; }
				else if (instr[i-1]=='F') { 				
					--j ; if (j-55<mn) mn = j-55 ; 
					graph[i][j] = 92 ; } }
		
		cout << "Case #" << nr++ << ':' << endl ; 
		for(j = mx ; j>=mn ; --j ) { cout << "| " ; 
			for(i=0 ; i<ln ; ++i) cout << graph[i][j+55] ; cout << " " << endl ;}
		cout << "+" ;  for(i=0 ; i<=ln+1 ; ++i) cout << "-" ; cout << endl << endl ; 	
		
		for(i=0;i<ln;++i) for(j=mn;j<=mx;++j) graph[i][j+55]= ' ' ; } 
return 0 ; }


Posted: Sat Jun 25, 2005 8:45 pm
by Raj Ariyan
Hi Christophoros,
Your programs prints blank space after the last column in any row. Say a input like --> CCFCRRCFFFCRCFCFRR. So after print constant at the first row the line should be stop. But ur code print blank space upto the given string length. Hope it helps. Thanx.