10800 - Not That Kind of Graph
Moderator: Board moderators
-
- New poster
- Posts: 8
- Joined: Mon Jan 22, 2007 9:08 pm
-
- New poster
- Posts: 8
- Joined: Mon Jan 22, 2007 9:08 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.
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...
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:
| /\
| ___/
+--------
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.
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.

-
- New poster
- Posts: 4
- Joined: Wed Nov 04, 2009 7:52 pm
Re: 10800 - Not That Kind of Graph
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.
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;
}
-
- New poster
- Posts: 4
- Joined: Wed Nov 04, 2009 7:52 pm
Re: 10800 - Not That Kind of Graph
what is this?????
Re: 10800 - Not That Kind of Graph
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.
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;
}
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 10800 - Not That Kind of Graph
Input:AC output:
Code: Select all
100
FRCCCRCFRFRCRFFFFRCCCFRFFCCFRRRCCRFFRFFC
FFRRRCCFFCFRCRFRRRRRFRRCCC
FFRCRCRFCCRCFCRCRFFFFCCCFRRRFRFRFCCFFCRCC
FRCCRCRCFFCFRFFRFCFFCCRC
RCCRFCFRCFFCFFFRRCFCFRCCFRCFFCFCFFCFFFCRCRCFC
CRRFRRFRCRRFFCFRCFCFR
RCCRRFCCRFFFRCCCCFRRFCCCRFFRRFFFRRFFCFFRFRRFRCFR
FRCRRCFCFFRRRF
RFRFRCFFFFFFFRCRCRRRFRCFCFFRCFCRRRFRRRRFCFFRC
FFFFFFCFCFRFCCCFCCFFFCCFFFRCRRFCFFFRCFCFRRRRRF
RRFCCRFFCFFCCFFFRCCFFFFRCCFCCRFCRCCFRF
RCCRFRFFCFRFRRCCCC
CFFRFCRRRRRRRCCRCRRRCFFFCFFFFRCRCFFFFF
CCCRRRRFCFFRFRCFRCCCRRRCCFFFRCFRFRRCRFFRRRRCFFRFR
FFFFFFFCRFCFCCCRFRCRFRFRRRFCC
RRFCRRRFCRRCC
FCFRRRCFFRFFRRFCCFRFRRFCFFRC
RRRRFFFFRCRFCCCC
CRRCFCFRFRCCRFRRFRFRFRFCRCFRCFCFFCCRCRFFFCFC
FCCRFRCFFCCCFRFRCFCCRFCFRFCCCCRCCR
RFRCRRFRFCCCCFRCCCC
CFRRCRRF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CCCCRCCFFRFCRRFCRRRFRFFRCF
FCFCFFRFFCFRFFFRFRCCRRRRRFCFRFRCRCCFFCRCCCRRFCRRCF
RFRFCCRRCFFCCRCFFFCFRFCRRFFFFRCCCCFFC
CRFRRRCCCRRCCFFFCCFRFRCRCFFRRRCCFRFFCRRFFFFCCR
FCCRCCCCCRFCFCCC
RRRRFRRRCFCCCFFRFCCFF
RCFFFF
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!
-
- New poster
- Posts: 6
- Joined: Fri Jun 21, 2013 3:31 am
Re: 10800 - Not That Kind of Graph
i have checked all the cases . But getting wrong . Please help me .
Here is my code :
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.
Re: 10800 - Not That Kind of Graph
Print a blank line after every output.
Code: Select all
enjoying life .....
Re: 10800 - Not That Kind of Graph
Loading cheak it
And must be print a blank line after every output
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;
}
Code: Select all
enjoying life .....
-
- New poster
- Posts: 6
- Joined: Fri Jun 21, 2013 3:31 am
Re: 10800 - Not That Kind of Graph
Thank You shuvokr .
I have printed a blank line after every output and removed all the spaces from my output .
but still getting WA
I have printed a blank line after every output and removed all the spaces from my output .
but still getting WA