## 10800 - Not That Kind of Graph

Moderator: Board moderators

Christophoros
New poster
Posts: 5
Joined: Thu Nov 25, 2004 12:56 am
Raj thanks for your help. It was straight at the point, and I got AC.
I assumed till now , that difference in blanks in general leads just to PEs problems, and nothing more. It seems that I found my counterexample...

Raj Ariyan
Learning poster
Posts: 70
Joined: Sat Feb 05, 2005 9:38 am
Location: Gurukul
Hi Christophoros,
Congrats, when the problem is generally a output related problem then we have to care every blank space or newline. So, every blank space after any valid column leads WA. But in others problems where output is not the main things, space after output gets PE. Good luck and bye. Some Love Stories Live Forever ....

okris
New poster
Posts: 2
Joined: Wed Aug 25, 2004 2:07 am
Location: Mexico

### Help with 10800

Please I read all the messages and prove my code, and my result is the same that outputs sends.

Code: Select all

``````
#include <iostream>
#include <string.h>

using namespace std;

int main()
{
char grafica={"\0"};
int tops={0};
int n,s,x,y,i,j,topx,topy,tope,boty;

for (i=0;i<120;i++)
{
for (j=0;j<70;j++)
grafica[i][j]=' ';
tops[i]=0;
}

cin >>n;
s=1;
while (n--)
{
x=2;
y=58;
topx=2;
topy=58;
boty=58;
ant='\0';
for (i=0;i<tope;i++)
{
{
if (ant==92)
{
y--;
grafica[y][x]='/';
topy=(y<topy)?y:topy;
boty=(y>boty)?y:boty;
tops[y]=(x>tops[y])?x:tops[y];
x++;
y--;
topx=x;
}
else
{
topy=(y<topy)?y:topy;
boty=(y>boty)?y:boty;
grafica[y][x]='/';
tops[y]=(x>tops[y])?x:tops[y];
x++;
y--;
topx=x;
}
ant='/';
}
else
{
if (ant==92)
{
y--;
grafica[y][x]='_';
tops[y]=(x>tops[y])?x:tops[y];
boty=(y>boty)?y:boty;
x++;
topx=x;
ant='_';
topy=(y<topy)?y:topy;
}
else
{
grafica[y][x]='_';
tops[y]=(x>tops[y])?x:tops[y];
topy=(y<topy)?y:topy;
x++;
topx=x;
}
ant='_';
}
else
{
if (ant=='/' || ant=='_')
{
y++;
grafica[y][x]=92;
tops[y]=(x>tops[y])?x:tops[y];
boty=(y>boty)?y:boty;
x++;
y++;
topx=x;
}
else
{
grafica[y][x]=92;
tops[y]=(x>tops[y])?x:tops[y];
boty=(y>boty)?y:boty;
x++;
y++;
topx=x;
}
topy=(y<topy)?y:topy;
ant=92;
}
}

cout <<"Case #"<<s<<":"<<endl;
s++;
boty++;

for (i=topy;i<boty;i++)
{
cout <<"| ";
for (j=2;j<=tops[i];j++)
{
cout<<grafica[i][j];
}
cout<<endl;
}
cout<<"+";
for (i=0;i<topx;i++)
cout <<"-";
cout <<endl;
cout<<endl;
for (i=0;i<120;i++)
{
for (j=0;j<70;j++)
grafica[i][j]=' ';
tops[i]=0;
}
}

return 0;
}

``````
C++

LPH
New poster
Posts: 34
Joined: Mon Nov 17, 2003 10:41 am
You can check those cases:

Code: Select all

``````18
F
C
R
FF
CC
RR
RF
FR
FCR
RCF
CFF
FCF
FFC
CRR
RCR
RRC
FRFR
RFRF``````
And the corresponding 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:
| /\/\
+------
``````
Hope this will help you find the problem LPH [acronym]
= Let Program Heal us
-- New Uncyclopedian Dictionary, Minmei Publishing Co.

n00i3
New poster
Posts: 20
Joined: Thu Sep 15, 2005 8:49 pm
Contact:
guys i was wondering if this was legal :S

Code: Select all

``````1
CCCFFFRFFF

Case #1:
| ___
|    \
|     \
|      \/\
|         \
|          \
+------------
``````
I dont know what im doing wrong but it seems to be working but i keep getting wa, there are no trailing spaces and i've tested all the inputs provided[/code]

Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)
n00i3 wrote:guys i was wondering if this was legal :S

Code: Select all

``````1
CCCFFFRFFF

Case #1:
| ___
|    \
|     \
|      \/\
|         \
|          \
+------------
``````
Yes, the input is legal...

If still having problems getting accepted, try to post your code here lovemagic
Learning poster
Posts: 52
Joined: Thu Oct 02, 2003 11:38 am

### 10800:where is my wrong?

I m messed up with this problem.I check all the i/o in the board but havnt found any wrong.But it still gets WA.
Smbody plz check my code......

Code: Select all

``````
#include <stdio.h>
#include <string.h>
#define max 120
char m[max][max],s[max];

void init(){
int i,j;
for(i=0;i<=110;i++)
for(j=0;j<=110;j++)
m[i][j]=' ';
for(i=0;i<=110;i++)m[i]='|';
}

void unnes(){
int i,j;
for(i=110;i>=0;i--){
for(j=110;j>=0;j--){
if(m[i][j]==' ')m[i][j]=NULL;
else break;
}
}
}

int main(){
int n,cases=1,l,i,j;
int r,c,m_r,h_r;
scanf("%d",&n);
gets(s);
for(;n>0;n--){
init();
gets(s);
l=strlen(s);
printf("Case #%d:\n",cases++);
r=55,c=2;
m_r=h_r=r;
for(i=0;i<l;i++){
if(s[i]=='R'){
m[r][c++]='/';
r--;
if(r<h_r)h_r=r;
}
else if (s[i]=='F'){
m[++r][c++]=92;
if(r>m_r)m_r=r;
}
else if(s[i]=='C')
m[r][c++]='_';
}
m_r++;
for(i=0;i<=c;i++)
m[m_r][i]='-';
unnes();
m[m_r]='+';
for(i=h_r;i<=m_r;i++){
if(strlen(m[i])==1)continue;
for(j=0;j<=c;j++)
printf("%c",m[i][j]);
printf("\n");
}
printf("\n");
}
return 0;
}

``````
khobaib

lovemagic
Learning poster
Posts: 52
Joined: Thu Oct 02, 2003 11:38 am
ok......I got AC.I just print with %s in stead of %c & that gives me AC.I dont know why %c got a WA.If smbody know,tell me why it's problem to use %c here.
khobaib

mamun
A great helper
Posts: 286
Joined: Mon Oct 03, 2005 1:54 pm
Contact:
Probably the reason is that %c prints a character (probably space) for a NULL character whereas %s doesn't.

asif_rahman0
Experienced poster
Posts: 209
Joined: Sun Jan 16, 2005 6:22 pm

### 10800 - Not That Kind of Graph

can someone tell me that why PE is happening for this problem?
below i pasted some I/O which my code generate.
Input:
5
RRFFFF
CCCCFFFF
CRRRR
FFFRRC
FFCCCR

Code: Select all

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

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

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

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

Case #5:
| \
|  \___/
+--------
``````

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
I don't know if it is just the formatting of the board, but those lines don't seem to be of the same length?

sakhassan
Experienced poster
Posts: 105
Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU
Am getting WA ... Don't know whats wrong...

Code: Select all

``````
Removed

``````
Last edited by sakhassan on Thu Dec 07, 2006 1:08 pm, edited 1 time in total.
Time that gone is gone forever ...

sakhassan
Experienced poster
Posts: 105
Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU
oh!! i got ma prob Time that gone is gone forever ...

softhacker
New poster
Posts: 2
Joined: Tue Jan 23, 2007 10:40 pm
Location: India
Contact:

### I m getting wrong Answer

I am getting wrong answer . can anyone help me .

Code: Select all

``````#include<algorithm>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define sz size()
#define pb push_back
#define all(a) a.begin(),a.end()

typedef vector<int> vi;
typedef vector<string> vs;
int main()
{
int n;
cin>>n;
for(int p=1;p<=n;p++)
{
string str="";int a;
memset(a,0,sizeof(a));
cin>>str;int j=200,k=1;
cout<<"Case #"<<p<<":";
for(int i=0;i<str.sz;i++)
{
if(str[i]=='C')
{
if(i==0)
{
a[j][k]=1;
continue;
}
if(str[i-1]=='R')
{
--j;++k;
a[j][k]=1;
continue;
}
if(str[i-1]=='F')
{
++k;
a[j][k]=1;
continue;
}
if(str[i-1]=='C')
{
++k;
a[j][k]=1;
continue;
}
}
if(str[i]=='R')
{
if(i==0)
{
a[j][k]=2;
continue;
}
if(str[i-1]=='C')
{
++k;
a[j][k]=2;
continue;
}
if(str[i-1]=='F')
{
++k;
a[j][k]=2;
continue;
}
if(str[i-1]=='R')
{
--j;++k;
a[j][k]=2;
continue;
}
}
if(str[i]=='F')
{
if(i==0)
{
a[j][k]=3;
continue;
}
if(str[i-1]=='R')
{
++k;
a[j][k]=3;
continue;
}
if(str[i-1]=='F')
{
++j;++k;
a[j][k]=3;
continue;
}
if(str[i-1]=='C')
{
++j;++k;
a[j][k]=3;
continue;
}
}
}
bool f1=false;
for(int i=0;i<400;i++)
{
bool f2=false;
for(j=0;j<=k;j++)
{
if(f1==false)
if(a[i][j]==1||a[i][j]==2||a[i][j]==3)
{
f1=true;
f2=true;
i=i-1;
//cout<<"|";
break;
}
if(f1)
{
if(a[i][j]==1)
{
cout<<"_";
f2=true;
continue;
}
if(a[i][j]==2)
{
cout<<"/";
f2=true;
continue;
}
if(a[i][j]==3)
{
cout<<"\\";
f2=true;
continue;
}
cout<<" ";
}
}
if(f1&&f2)
{
cout<<endl;
cout<<"|";
}
if(f2==false&&f1==true)
{
for(int r=0;r<=k+1;r++)
cout<<"\b";
cout<<"+";
for(int l=1;l<=k+2;l++)
cout<<"-";
cout<<"\n";
break;
}
}
cout<<"\n";
}
return 0;
}``````
[/code]

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

### help needed

Hi all,
I have checked my code with all the ip given here and it works fine with all.
yet i get the pestering WA..
I have also removed any trailing spaces and have removed the last extra '\n'
can there be any other error that i bypassed..