Page 2 of 4

Posted: Sat Jun 25, 2005 11:19 pm
by Christophoros
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...

Posted: Sun Jun 26, 2005 5:32 am
by Raj Ariyan
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. :D

Help with 10800

Posted: Thu Sep 01, 2005 8:51 pm
by okris
Please I read all the messages and prove my code, and my result is the same that outputs sends.

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



Posted: Mon Sep 05, 2005 6:55 pm
by LPH
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 :)

Posted: Tue Sep 20, 2005 8:22 pm
by n00i3
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]

Posted: Fri Sep 23, 2005 2:45 am
by Martin Macko
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 :)

10800:where is my wrong?

Posted: Fri Dec 02, 2005 6:49 pm
by lovemagic
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][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;
}


Posted: Sat Dec 03, 2005 8:45 pm
by lovemagic
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.

Posted: Sat Dec 03, 2005 9:14 pm
by mamun
Probably the reason is that %c prints a character (probably space) for a NULL character whereas %s doesn't.

10800 - Not That Kind of Graph

Posted: Thu Jun 08, 2006 8:36 am
by asif_rahman0
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:
| \      
|  \___/ 
+--------

Posted: Thu Jun 08, 2006 10:31 am
by Darko
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?

Posted: Thu Dec 07, 2006 12:44 pm
by sakhassan
Am getting WA ... :cry: Don't know whats wrong...

Code: Select all


Removed


Posted: Thu Dec 07, 2006 1:07 pm
by sakhassan
oh!! i got ma prob :D

I m getting wrong Answer

Posted: Tue Jan 23, 2007 10:48 pm
by softhacker
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[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;
}
[/code]

help needed

Posted: Tue Jan 30, 2007 4:41 pm
by Viswanathan V
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..