10800 - Not That Kind of Graph

All about problems in Volume 108. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

10800 - Not That Kind of Graph

Post by Eduard » Thu Jan 13, 2005 3:28 pm

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.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

sidky
New poster
Posts: 50
Joined: Wed Nov 06, 2002 1:37 pm
Location: Planet Earth, Universe
Contact:

Post by sidky » Thu Jan 13, 2005 4:12 pm

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.

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard » Thu Jan 13, 2005 8:24 pm

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.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

w k
Learning poster
Posts: 74
Joined: Wed Apr 14, 2004 11:14 pm

Post by w k » Thu Jan 13, 2005 8:45 pm

Edouard,

Check for trailing spaces in each line!

Wojciech

Eduard
Experienced poster
Posts: 183
Joined: Fri Sep 26, 2003 2:54 pm
Location: Armenia,Yerevan

Post by Eduard » Thu Jan 13, 2005 9:01 pm

Ok I find my mistake and got AC.
Eduard.
someone who like to solve informatic problems.
http://acm.uva.es/cgi-bin/OnlineJudge?AuthorInfo:29650

User avatar
Sedefcho
A great helper
Posts: 374
Joined: Sun Jan 16, 2005 10:18 pm
Location: Bulgaria

Post by Sedefcho » Tue Feb 22, 2005 7:10 pm

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:
|                                                          ________
|                                                         /
|                                         _______________/
|                                        /
|   __                   _______________/
|  /  \                 /
| /    \_______________/
+-------------------------------------------------------------------


User avatar
Sedefcho
A great helper
Posts: 374
Joined: Sun Jan 16, 2005 10:18 pm
Location: Bulgaria

Post by Sedefcho » Tue Feb 22, 2005 7:11 pm

That's the output from an ACC program of course.

dootzky
New poster
Posts: 36
Joined: Tue Apr 12, 2005 12:20 am
Location: belgrade, serbia (ex yugoslavia)
Contact:

ummm..... HEEEEELP!!

Post by dootzky » Tue Apr 12, 2005 12:26 am

cheers guys, after 10 attempts i got ACCEPTED!!

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

cheers,
dootzky

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

10800 - Not That Kind of Graph

Post by Raj Ariyan » Sat May 28, 2005 5:01 pm

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.
Some Love Stories Live Forever ....

myqbzi
New poster
Posts: 5
Joined: Thu Jul 22, 2004 3:12 pm
Location: Croatia

Post by myqbzi » Sat May 28, 2005 5:48 pm

Code: Select all

4
RCRFCRFFCCRRC
FFFCCC
RFCRFC
CCCRRF

Output:

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

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

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

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

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

Thanx

Post by Raj Ariyan » Sat May 28, 2005 6:27 pm

Hi myqbzi,
Thank You. It really helps me. I missed the second case. Thanx again. Bye.
Some Love Stories Live Forever ....

Christophoros
New poster
Posts: 5
Joined: Thu Nov 25, 2004 12:56 am

Post by Christophoros » Fri Jun 24, 2005 11:22 pm

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

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

Post by Raj Ariyan » Sat Jun 25, 2005 6:10 am

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:
|                                          /\
|                       /\                /  \
|                      /  \              /    \
|       /\            /    \            /      \
|      /  \          /      \          /        \
|     /    \        /        \        /          \
|    /      \      /          \      /            \
| __/        \____/            \____/              \
+----------------------------------------------------

Some Love Stories Live Forever ....

Christophoros
New poster
Posts: 5
Joined: Thu Nov 25, 2004 12:56 am

Post by Christophoros » Sat Jun 25, 2005 3:24 pm

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 ; }


Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul

Post by Raj Ariyan » Sat Jun 25, 2005 8:45 pm

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.
Some Love Stories Live Forever ....

Post Reply

Return to “Volume 108 (10800-10899)”