10800 - Not That Kind of Graph
Moderator: Board moderators
-
- New poster
- Posts: 5
- Joined: Thu Nov 25, 2004 12:56 am
-
- 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.
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 ....
Help with 10800
Please I read all the messages and prove my code, and my result is the same that outputs sends.
Please check my code:
Please check my code:
Code: Select all
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char grafica[120][70]={"\0"};
int tops[120]={0};
char cadena[53]={"\0"},limpia[60]={"\0"},ant='\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;
cin.getline(cadena,0);
s=1;
while (n--)
{
cin.getline(cadena,52);
x=2;
y=58;
topx=2;
topy=58;
boty=58;
tope=strlen(cadena);
ant='\0';
for (i=0;i<tope;i++)
{
if (cadena[i]=='R')
{
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 (cadena[i]=='C')
{
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 (cadena[i]=='F')
{
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;
}
strcpy(cadena,"\0");
}
return 0;
}
C++
You can check those cases:
And the corresponding output:
Hope this will help you find the problem 
Code: Select all
18
F
C
R
FF
CC
RR
RF
FR
FCR
RCF
CFF
FCF
FFC
CRR
RCR
RRC
FRFR
RFRF
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:
| /\/\
+------

LPH [acronym]
= Let Program Heal us
-- New Uncyclopedian Dictionary, Minmei Publishing Co.
= Let Program Heal us
-- New Uncyclopedian Dictionary, Minmei Publishing Co.
guys 
i was wondering if this was legal :S
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]

i was wondering if this was legal :S
Code: Select all
1
CCCFFFRFFF
Case #1:
| ___
| \
| \
| \/\
| \
| \
+------------
-
- A great helper
- Posts: 481
- Joined: Sun Jun 19, 2005 1:18 am
- Location: European Union (Slovak Republic)
Yes, the input is legal...n00i3 wrote:guys
i was wondering if this was legal :S
Code: Select all
1 CCCFFFRFFF Case #1: | ___ | \ | \ | \/\ | \ | \ +------------
If still having problems getting accepted, try to post your code here

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......
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][0]='|';
}
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][0]='+';
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
-
- 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
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:
| \
| \___/
+--------
Last edited by sakhassan on Thu Dec 07, 2006 1:08 pm, edited 1 time in total.
Time that gone is gone forever ...
-
- 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]
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[400][400];
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;
}
-
- 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..
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..