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

Viswanathan V
New poster
Posts: 8
Joined: Mon Jan 22, 2007 9:08 pm

Post by Viswanathan V » Tue Jan 30, 2007 4:51 pm

Hi,
I have tried all the test cases in the board and still got a WA..trailing spaces have been removed and i checked with the last '\n' on and out.Still got WA.
is there anything i missed?any critical IO u feel will help me?

Viswanathan V
New poster
Posts: 8
Joined: Mon Jan 22, 2007 9:08 pm

Post by Viswanathan V » Tue Jan 30, 2007 6:23 pm

Hi all ,
i found my error
it was abt printing '-' at x axis instead of '_'
and print the last '\n' to avoid PE.
ppl needn't reply to my post in the other thread..
bye

Vexorian
Learning poster
Posts: 100
Joined: Sat Aug 26, 2006 5:50 am

Post by Vexorian » Wed Jan 31, 2007 5:45 pm

I am getting PE as well, I tried removing the last extra blank line (thus I also tried with that line as well) . I have no idea.

Code: Select all

8
RCRFCRFFCCRRC
CCCCCCCCCCCCC
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
RCRFCRFFCCRRC
FFFCCC
RFCRFC
CCCRRF

Code: Select all

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

Case #2:
| _____________
+---------------

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

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

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

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

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

Case #8:
|     /\
| ___/
+--------
I really think OJ should tell you what is the PE , this is not like WA where there's a mistake in implementation and sometimes PE are more about guessing stuff than anything else...

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo » Wed Jan 31, 2007 5:59 pm

Problem statement says "print an empty line after each test case." so, don't remove the blank line at the end..
First, I got PE on this problem.. and coundn't find anything wrong..
then I recoded and got AC..
I guess there maybe some trailing spaces for some cases.. I'm not sure..

Vexorian
Learning poster
Posts: 100
Joined: Sat Aug 26, 2006 5:50 am

Post by Vexorian » Wed Jan 31, 2007 6:02 pm

hmnn I had the final line and it was giving PE.

I think I am printing some trailing spaces that could be considered unnecessary

Edit: Yes, shall not print any space after the last character of a row, got AC thanks. asif_rahman0: It seems your input also has this issue.

User avatar
Donotalo
Learning poster
Posts: 56
Joined: Sat Aug 20, 2005 11:05 am
Location: Bangladesh

Post by Donotalo » Sat Oct 27, 2007 6:37 pm

checked all i/o-s in this board but could not get the reason i'm getting wa in this problem. can anyone please check my code?

thanks in advance. :)

Code: Select all

//Problem 10800
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
        (removed)
	return 0;
}
Last edited by Donotalo on Mon Oct 29, 2007 2:58 pm, edited 1 time in total.
Image

helloneo
Guru
Posts: 516
Joined: Mon Jul 04, 2005 6:30 am
Location: Seoul, Korea

Post by helloneo » Sat Oct 27, 2007 6:52 pm

Output description says..
print an empty line after each test case
:-)

blackcloud1971
New poster
Posts: 4
Joined: Wed Nov 04, 2009 7:52 pm

Re: 10800 - Not That Kind of Graph

Post by blackcloud1971 » Wed Nov 04, 2009 8:03 pm

I am getting wrong answer. Output for all the given inputs are seemed to be OK. I can't understand the trailing space matter. Is it alright to print space between two graph characters??

Can anyone please check my code and find the bug for me??? thanks in advance.

Code: Select all

#include<stdio.h>
#include<stdlib.h>

int main(){
	char input[110];
	char graph[110];
	int i=0, len =0, level = 0;
	int up_peak = -55;
	int co_x, co_y;
	int maxy;	
	int j;
	int matrix[110][110] = {'0'};


	unsigned long int test_case, case_count = 1;

	gets(input);

	test_case = atoi(input);

	while(case_count <= test_case){		

		gets(input);

		i = len = level= 0;
		up_peak = 0;

		if(input[i] == 'R') graph[i] = '/';
		else if(input[i] == 'C') graph[i] = '_';
		else graph[i] = '\\';

		i++;
		len++;

/*** finds the highest value at Y-axis and
	 puts the graph characters accordingly
	 into graph[] array
***/

		while(input[i]){
				
			if(input[i] == 'R'){

				graph[i] = '/';
				if(input[i-1] == 'R') level++;
			}

			else if(input[i] == 'C'){
				graph[i] = '_';
				if(input[i-1] == 'R') level++;		
			}

			else{
				graph[i] = '\\';
				if(input[i-1] != 'R') level--;
			}

			if(level > up_peak) up_peak = level;

			len++;
			i++;

		}
		
		graph[i] = '\0';
		
		maxy = 0;
			
		co_x = 2;
		co_y = up_peak;

		for(i=0; i<51; i++)
			for(j=0; j<54; j++)
				matrix[i][j] = 0;


		matrix[0][0] = '|';

		i = 0;
		matrix[co_y][co_x] = graph[i++];
		matrix[co_y][53] = co_x;

		matrix[co_y][0] = '|';
		
		if(maxy < co_y) maxy = co_y;

		while(graph[i]){
			co_x++;
			
			if(graph[i] == '\\' && (graph[i-1] == '_' || graph[i-1] == '\\')){
				matrix[++co_y][co_x] = graph[i];
				matrix[co_y][53] = co_x;
			}

			else if(graph[i] == '/' && graph[i-1] == '/'){
				matrix[--co_y][co_x] = graph[i];
				matrix[co_y][53] = co_x;
			}

			else if(graph[i] == '_' && graph[i-1] == '/'){
				matrix[--co_y][co_x] = graph[i];
				matrix[co_y][53] = co_x;
			}
				
			else{
				matrix[co_y][co_x] = graph[i];
				matrix[co_y][53] = co_x;
			}

			i++;

			matrix[co_y][0] = '|';

			if(maxy < co_y) maxy = co_y;

		}

		matrix[++maxy][0] = '+';

		len += 2;

		for(i=1; i <= len; i++)
			matrix[maxy][i] = '-';
		
		matrix[maxy][53] = len;

		printf("Case #%lu:\n", case_count);

		for(i=0; i<=maxy; i++){
			for(j=0; j<=matrix[i][53]; j++)
				printf("%c", matrix[i][j]);
			printf("\n");
		}

		printf("\n");

		case_count++;

	}

	return 0;

}

blackcloud1971
New poster
Posts: 4
Joined: Wed Nov 04, 2009 7:52 pm

Re: 10800 - Not That Kind of Graph

Post by blackcloud1971 » Wed Dec 09, 2009 11:41 am

what is this?????

issac923
New poster
Posts: 1
Joined: Fri Feb 08, 2013 7:23 pm

Re: 10800 - Not That Kind of Graph

Post by issac923 » Fri Feb 08, 2013 7:27 pm

I am getting wrong answer too. I found no difference between the sample output generated in the uva toolkit.
Can anyone please help me to find the bug? Thanks a lot.

Code: Select all

#include<iostream>
#include<string>
using namespace std;
int empty(char *graph[],int x,int y)
{
    int stop=x;
    for (int i=x-1;i>0;--i)
    {
        if (graph[i][y]!=' ') break;
        stop=i;
    }
    return stop;
}

void display(char *graph[],int x,int y)
{
     for (int j=0;j<y;++j)
     {
         for (int i=0;i<empty(graph,x,j);++i)
         {
             cout << graph[i][j];
         }
         cout << '\n';
     }
     cout << '\n';
}

void draw(char *graph[],string comd,int x,int y,int max)
{
     int s=0;
     if(max-1>0)s=max-1;
     graph[0][y-1]='+';
     for (int i=1;i<x;++i)
     {
         graph[i][y-1]='-';
     }
     for (int i=0;i<y-1;++i)
     {
         graph[0][i]='|';
     }
     for (int i=0;i<y-1;++i)
     {
         graph[1][i]=' ';
     }
     for (int i=1;i<x;++i)
     {
         for(int j=0;j<y-1;++j)
         {
                 graph[i][j]=' ';
         }
     }
     for (int i=2;i<x;++i)
     {
         if (comd[i-2]=='C'){ graph[i][s]='_'; if(i-1<comd.size()&&comd[i-1]=='F')++s;}
         if (comd[i-2]=='R'){ graph[i][s]='/'; if(i-1<comd.size()&&comd[i-1]!='F')--s;}
         if (comd[i-2]=='F'){ graph[i][s]=92; if(i-1<comd.size()&&comd[i-1]=='F')++s;}
     }
}

int main()
{
    int n=0,x,y,max,min,curr,num=1;
    string comd;
    cin >> n;
    char **graph;
    while(n!=0)
    {
        max=0;
        min=0;
        cin>>comd;
        y=0;
        curr=0;
        x=comd.size()+3;
        for (int i=0;i<comd.size();++i)
        {
            if(comd[i]=='R'){ ++curr; if(curr>max) max=curr;}
            else if(comd[i]=='F'){ --curr; if(curr<min) min=curr;}
        }
        y=max-min;
        curr=0;
        for (int i=0;i<comd.size();++i)
        {
            if(comd[i]=='R') ++curr;
            else if(comd[i]=='F') --curr;
            else if(comd[i]=='C'){if(curr==max){ ++y; ++max;}}
        }
        ++y;
        graph=new char*[x];
        for (int i=0;i<x;++i)
        {
            graph[i]=new char[y];
        }
        draw(graph,comd,x,y,max);
        cout << "Case #" << num++ << ':' << '\n';
        display(graph,x,y);
        delete[] graph;
        --n;
    }
    return 0;
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 10800 - Not That Kind of Graph

Post by brianfry713 » Fri Feb 08, 2013 9:16 pm

Input:

Code: Select all

100
FRCCCRCFRFRCRFFFFRCCCFRFFCCFRRRCCRFFRFFC
FFRRRCCFFCFRCRFRRRRRFRRCCC
FFRCRCRFCCRCFCRCRFFFFCCCFRRRFRFRFCCFFCRCC
FRCCRCRCFFCFRFFRFCFFCCRC
RCCRFCFRCFFCFFFRRCFCFRCCFRCFFCFCFFCFFFCRCRCFC
CRRFRRFRCRRFFCFRCFCFR
RCCRRFCCRFFFRCCCCFRRFCCCRFFRRFFFRRFFCFFRFRRFRCFR
FRCRRCFCFFRRRF
RFRFRCFFFFFFFRCRCRRRFRCFCFFRCFCRRRFRRRRFCFFRC
FFFFFFCFCFRFCCCFCCFFFCCFFFRCRRFCFFFRCFCFRRRRRF
RRFCCRFFCFFCCFFFRCCFFFFRCCFCCRFCRCCFRF
RCCRFRFFCFRFRRCCCC
CFFRFCRRRRRRRCCRCRR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FFRRCRRRCFCCFRRFR
RRRRCRCCCRFCFCFRRFRFFRR
RCRFRFRFCRFCCCFFCCFFRCCFRRRCFRCCCFRRRRCCCFCCFR
RFCCCFCRCRRFFRCFFFFCFRFFCRRFFCCRFCRRRRRCRFCCCF
FCCRRCRCFRFR
RRRFCFCCFCRCFCFCFCRRCCFFCFRCCFRRCRCFCFCFFR
RRCCFCRCFCRRFFFCFRCC
FFCRRCCCCRRR
RFFR
RFFRRRCCCRRFRFFCCFCFFCRFRFFCC
FCFCCFRCCCCRCCFFRFCRRFCRRRFRFFRCF
FCFCFFRFFCFRFFFRFRCCRRRRRFCFRFRCRCCFFCRCCCRRFCRRCF
RFRFCCRRCFFCCRCFFFCFRFCRRFFFFRCCCCFFC
CRFRRRCCCRRCCFFFCCFRFRCRCFFRRRCCFRFFCRRFFFFCCR
FCCRCCCCCRFCFCCC
RRRRFRRRCFCCCFFRFCCFF
RCFFFF
AC 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:
|                                            _
|                                           / \
|                        __                /   \/\/
|                       /  \         _/\  /
|       /\_            /    \  _    /   \/
|      /   \    _  ___/      \/ \/\/
|     /     \/\/ \/
| ___/
+---------------------------------------------------

Case #15:
| \
|  \
|   \
|    \
|     \                    /\__
|      \                  /
|       \_/\_       _/\/\/
|            \___/\/
+-------------------------------

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

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

Case #18:
|    /\
|   /  \
|  /    \  _/\____
| /      \/
+------------------

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

Case #20:
|       _
| \__/\/ \
|         \___    _
|             \/\/ \__/\_        __/
|                        \/\____/
+------------------------------------

Case #21:
|      /\/\____  ____
|    _/        \/
| /\/
+---------------------

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

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

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

Case #25:
|                                _
|                           /\__/
|                          /
| _/\_     _/\            /
|     \  _/   \___   _/\_/
|      \/         \_/
+----------------------------------

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

Case #27:
|                             /\__/\
|                      /\____/      \        /\_/\
|                     /              \/\/\/\/
|                    /
|                 /\/
|              __/
|            _/
|           /
| _/\      /
|    \    /
|     \  /
|      \/
+--------------------------------------------------

Case #28:
| \  ________
|  \/        \__  _/\  /\_
|               \/   \/   \_   /\_/\__      _/\
|                           \_/       \  /\/   \
|                                      \/
+------------------------------------------------

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

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

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

Case #32:
| ___  __                               __
|    \/  \_      /\  ___   /\__        /  \_  /\
|          \    /  \/   \_/    \__  /\/     \/
|           \/\/                  \/
+------------------------------------------------

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

Case #34:
|    ____  /\_/\
| __/    \/     \
|                \/\_
|                    \_
|                      \_
|                        \__
|                           \_
|                             \_
|                               \/\
+-----------------------------------

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

Case #36:
|           _
|     __  _/ \/\/\
|    /  \/        \_
| /\/               \
|                    \
|                     \  ____    /\/\
|                      \/    \/\/    \    /\
|                                     \/\/  \  _
|                                            \/
+------------------------------------------------

Case #37:
| _
+---

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

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

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

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

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

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

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

Case #45:
| \
|  \_
|    \
|     \
|      \__  _/\/\_
|         \/      \      ___
|                  \__  /
|                     \/
+----------------------------

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

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

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

Case #49:
|                                      _
|                                     / \     /\
|                                   _/   \_/\/  \  /
|                                  /             \/
|                                _/
|             /\_            /\_/
|           _/   \/\     /\_/
|          /        \___/
|    _    /
| /\/ \__/
+----------------------------------------------------

Case #50:
|                        _/\_
|                     __/
|                    /
|                ___/
|               /
|     _       _/
|   _/ \     /
| _/    \_/\/
+-----------------------------

Case #51:
|                             /
|                            /
|                     /\  /\/
|      ___  _    _  _/  \/
|    _/   \/ \__/ \/
|   /
| _/
+-------------------------------

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

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

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

Case #55:
|               _
|              /
|      /\_____/
|     /
| _/\/
+-----------------

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

Case #57:
|                   _              /\_    /\
|                 _/ \  _         /   \__/  \
|           /\___/    \/ \/\    _/
|         _/                \/\/
|     _  /
|  __/ \/
| /
+---------------------------------------------

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

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

Case #60:
|                                /\
|                           _/\_/  \
|                          /        \_
|                       __/
|                      /
|                     /
|                    /
|                   /
|              _/\_/
|            _/
|      /\___/
| _  _/
|  \/
+--------------------------------------

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

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

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

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

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

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

Case #67:
|                                       _    /
|                                      / \  /
|                                     /   \/
|                                __  /
|                             __/  \/
|                            /
|          _/\             _/
|  /\  ___/   \  _      __/
| /  \/        \/ \_  _/
|                   \/
+----------------------------------------------

Case #68:
|                    ____/\
|                   /      \  _
|                  /        \/ \_
|  _      __/\  /\/              \_
| / \__  /    \/                   \
|      \/                           \_/\__
+------------------------------------------

Case #69:
|               _  _       /
|              / \/ \___  /
|            _/         \/
|      _    /
| __  / \  /
|   \/   \/
+----------------------------

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

Case #71:
|                     ___
|               _/\__/   \__/\_  _   /\_
|           _  /               \/ \_/   \_
| /\  __  _/ \/
|   \/  \/
+------------------------------------------

Case #72:
| _
|  \   _
|   \_/ \___
|           \_
|             \___/\__
|                     \
|                      \/\
|                         \
|                          \
|                           \
|                            \/
+-------------------------------

Case #73:
|         __/\_/\__
| ___    /
|    \__/
+-------------------

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

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

Case #76:
| _/\
|    \
|     \
|      \_  /\_/\_      /\
|        \/      \__  /  \___
|                   \/       \__/\_
|                                  \_/\__
|                                        \/
+-------------------------------------------

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

Case #78:
|                  _
|                 / \____        _
|             ___/       \_  _/\/ \/
|    _   _   /             \/
| \_/ \_/ \_/
+------------------------------------

Case #79:
|  __/\_
| /     \_
|         \      ___
|          \____/   \  _
|                    \/
+------------------------

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

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

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

Case #83:
|                                      ____
|                                     /
|                                  /\/
|                                 /
|                              __/
|                             /
|                           _/
|                         _/
| \      _  _/\_/\/\_   _/
|  \_   / \/         \_/
|    \_/
+-------------------------------------------

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

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

Case #86:
|                                       ___
|                                      /   \__
|  _/\/\/\_/\___                      /       \/
| /             \            _  ___  /
|                \__        / \/   \/
|                   \  __  /
|                    \/  \/
+------------------------------------------------

Case #87:
|           /\  _
| /\___   _/  \/ \                       _/\___
|      \_/        \                     /      \
|                  \                   /
|                   \_                /
|                     \/\   /\       /
|                        \_/  \__/\_/
+------------------------------------------------

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

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

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

Case #91:
|            /
|           /
|      ____/
| \   /
|  \_/
+--------------

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

Case #93:
|           /\/\
|       ___/    \__
|      /           \_
| /\  /              \
|   \/                \_/\/\
|                           \__
+-------------------------------

Case #94:
|                          /\/\  _
| \_          __          /    \/ \
|   \__  ____/  \     /\_/
|      \/        \/\_/
+-----------------------------------

Case #95:
|                                                 _
| \_                                             / \
|   \_                             __        /\_/
|     \                   /\_    _/  \   ___/
|      \/\               /   \/\/     \_/
|         \_            /
|           \/\        /
|              \    __/
|               \/\/
+----------------------------------------------------

Case #96:
|         _
|        / \    _
| /\/\__/   \__/ \
|                 \
|                  \_     /\
|                    \/\_/  \
|                            \  ____
|                             \/    \
|                                    \_
+---------------------------------------

Case #97:
|            __
|           /  \                __
|       ___/    \         _    /  \/\   /\
|      /         \__    _/ \  /      \_/  \
|     /             \/\/    \/             \
| _/\/                                      \__/
+------------------------------------------------

Case #98:
|     _____/\_
| \__/        \___
+------------------

Case #99:
|         _
|        / \___
|       /      \
|    /\/        \/\__
|   /                \
|  /                  \
| /
+-----------------------

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

Check input and AC output for thousands of problems on uDebug!

Loading...
New poster
Posts: 6
Joined: Fri Jun 21, 2013 3:31 am

Re: 10800 - Not That Kind of Graph

Post by Loading... » Tue Jun 25, 2013 11:14 pm

i have checked all the cases . But getting wrong . Please help me .
Here is my code :

Code: Select all

#include <stdio.h>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <cstdlib>
#include <algorithm>                   // Munna ??
#include <iostream>

using namespace std;

#define sf scanf
#define pf printf
#define maxm 100000
#define mem(a,b) memset(a,b,sizeof(a))
#define eps 1e-11

char str[100];
char V[100][100];
int len,cut,mat,tall;

void space(int i,int j){
    int m;
    for(m=1;m<=tall;m++){
        if(m!=i){
            V[m][j]=0;
        }
    }
}


int main(){

    int cases=0,i,j,k,t,see,jee,mall,st;
    char ch;
    sf("%d%c",&t,&ch);
    k=t;
    while(t--){
        st=1000;
        gets(str);
        len=strlen(str);
        mat=cut=tall=see=jee=mall=0;
        for(i=0;i<len;i++){
            if(str[i]=='R') { see++; jee--;}
            else if(str[i]=='F'){ see--; jee++;}

            if(see>tall) tall=see;
            if(jee>mall) mall=jee;
        }

        cut=tall;
        tall+=mall;

        pf("Case #%d:\n",++cases);

        for(i=0;i<=tall;i++){
            V[i][0]='|';
        }

        for(i=0;i<len;i++){
            if(str[i]=='R'){
                V[cut][i+1]='/';
                space(cut,i+1);
                if(cut<st) st=cut;
                cut--;
            }
            else if(str[i]=='F'){
                V[cut+1][i+1]= '\\' ;
                space(cut+1,i+1);
                if(cut+1<st) st=cut+1;
                cut++;
            }
            else{
                V[cut][i+1]= '_' ;
                if(cut<st) st=cut;
                space(cut,i+1);
            }
        }

        V[tall+1][0]='+';
        char ab[10];
        ab[0]=0;

        for(i=st;i<=tall;i++){
            for(j=0;j<=len;j++){
                pf("%c",V[i][j]);
                if(j==0) pf("%c",ab[0]);
            }
            pf("\n");
        }

        pf("%c",V[tall+1][0]);
        for(i=1;i<=len+2;i++) pf("-");
        pf("\n");
        pf("\n");
        mem(V,0);

    }

    return 0;
}




Last edited by Loading... on Wed Jun 26, 2013 1:09 am, edited 1 time in total.

shuvokr
Learning poster
Posts: 66
Joined: Tue Oct 02, 2012 8:16 pm
Location: Bangladesh

Re: 10800 - Not That Kind of Graph

Post by shuvokr » Wed Jun 26, 2013 12:43 am

Print a blank line after every output.

Code: Select all

enjoying life ..... 

shuvokr
Learning poster
Posts: 66
Joined: Tue Oct 02, 2012 8:16 pm
Location: Bangladesh

Re: 10800 - Not That Kind of Graph

Post by shuvokr » Wed Jun 26, 2013 1:02 am

Loading cheak it

Code: Select all

    #include <stdio.h>
    #include <cstring>
    #include <cmath>
    #include <map>
    #include <vector>
    #include <stack>
    #include <queue>
    #include <cstdlib>
    #include <algorithm>                   // Munna ??
    #include <iostream>

    using namespace std;

    #define sf scanf
    #define pf printf
    #define maxm 100000
    #define mem(a,b) memset(a,b,sizeof(a))
    #define eps 1e-11

    char str[100];
    char V[100][100];
    int len,cut,mat,tall;

    void space(int i,int j){
        int m;
        for(m=1;m<=tall;m++){
            if(m!=i){
                V[m][j]=32;
            }
        }
    }


    int main(){

        int cases=0,i,j,k,t,see,jee,mall,st;
        char ch;
        sf("%d%c",&t,&ch);
        k=t;
        while(t--){
            st=1000;
            gets(str);
            len=strlen(str);
            mat=cut=tall=see=jee=mall=0;
            for(i=0;i<len;i++){
                if(str[i]=='R') { see++; jee--;}
                else if(str[i]=='F'){ see--; jee++;}

                if(see>tall) tall=see;
                if(jee>mall) mall=jee;
            }

            cut=tall;
            tall+=mall;

            pf("Case #%d:\n",++cases);

            for(i=0;i<=tall;i++){
                V[i][0]='|';
            }

            for(i=0;i<len;i++){
                if(str[i]=='R'){
                    V[cut][i+1]='/';
                    space(cut,i+1);
                    if(cut<st) st=cut;
                    cut--;
                }
                else if(str[i]=='F'){
                    V[cut+1][i+1]= 92 ;
                    space(cut+1,i+1);
                    if(cut+1<st) st=cut+1;
                    cut++;
                }
                else{
                    V[cut][i+1]= '_' ;
                    if(cut<st) st=cut;
                    space(cut,i+1);
                }
            }

            V[tall+1][0]='+';

            for(i=st;i<=tall;i++){
                for(j=0;j<=len;j++){
                    pf("%c",V[i][j]);
                    if(j==0) pf(" ");
                    // edited by me for cheaking unnecessary space print
                    if(j == len)
                        if(V[ i ][ j ] == ' ') puts("not ok");
                    // Your code print unnecessary space, as a result you got WA
                    /*
                        try this input
                        1
                        RCRFCRFFCCRRC
                    */
                    //
                }
                pf("\n");
            }

            pf("%c",V[tall+1][0]);
            for(i=1;i<=len+2;i++) pf("-");
            pf("\n");
            if(cases!=k) pf("\n");
            mem(V,0);

        }

        return 0;
    }
And must be print a blank line after every output

Code: Select all

enjoying life ..... 

Loading...
New poster
Posts: 6
Joined: Fri Jun 21, 2013 3:31 am

Re: 10800 - Not That Kind of Graph

Post by Loading... » Wed Jun 26, 2013 1:27 am

Thank You shuvokr .

I have printed a blank line after every output and removed all the spaces from my output .
but still getting WA

Post Reply

Return to “Volume 108 (10800-10899)”