oh i got it.....
i got my mistake but still don't know what should be the right code...
or right algorithm...

by the way thanks to everybody who helped me...


On May 28, 11:14 pm, Carlos Guia <[email protected]> wrote:
> I'm pretty sure Bharath is right on that one. A.at(A.size()) is going to
> throw an exception no matter the size or values of A. Changing that may not
> make the algorithm right, but that instruction is wrong nevertheless, it is
> always accessing an element outside A's range.
>
> The algorithm itself has other errors, you must print the rectangle that
> encloses the image, not process lines independently. For example:
>
> Input
> ....
> *.*.
> ..*.
> ....
> *...
>
> Correct output
> *.*
> ..*
> ...
> *..
>
> Your logic's output:
> *.*
> *
> *
>
> Carlos Guía
>
> On Fri, May 28, 2010 at 1:16 PM, Aamir Khan <[email protected]> wrote:
> > i have written i<A.size().....not i<=A.size()....
> > i think thats not error..and i have tried it also
>
> > On May 28, 5:35 pm, Bharath Raghavendran <[email protected]> wrote:
> > >  I dont know what the question is or what the algo is supposd to do. But
> > i
> > > guess the error is happening at this point :
> > > A.at(A.size())
>
> > > maybe you need to do A.at(A.size()-1) ?
>
> > > On 28 May 2010 17:49, Aamir Khan <[email protected]> wrote:
>
> > > > I was doing some practice for codeforces round 15 to be held in around
> > > > 27 hours from now....
> > > > I have written the C++ source code for codeforces round 14/A problem
> > > > (Letter)...
> > > > I am getting runtime error which i am not able to understand...
> > > > Please help..
>
> > > > Error:
>
> > > > terminate called after throwing an instance of 'std::out_of_range'
> > > >  what():  vector::_M_range_check
> > > > Aborted
>
> > > > Source Code:
> > > > /**************
> > > > Header Files
> > > > **************/
>
> > > > #include <iostream>
> > > > #include <vector>
> > > > #include <cstdio>
> > > > #include <cstdlib>
> > > > #include <stdexcept>
> > > > #include <string>
> > > > #include <iomanip>
>
> > > > using namespace std;
>
> > > > typedef vector<int> vi;
>
> > > > int main()
> > > > {
> > > > int row,col;
> > > > cin>>row>>col;
> > > > const int cols=col;
> > > > const int rows=row;
> > > > char Array[rows][cols];
> > > > string sentence;
> > > > vi  A;
> > > > vi  B;
>
> > > > for(int  i=0;i<rows;i++)
> > > > {  cin>>sentence;
> > > >  for (int j=0;j<cols;j++)
> > > >   {    Array[i][j]=sentence[j];
> > > >            if (Array[i][j]=='*')
> > > >        {  A.push_back(i);
> > > >               B.push_back(j);  }
>
> > > >   }
> > > > }
>
> > > > for(int i=A.at(0);i<A.at(A.size());i++)
> > > > {
> > > >  int max_B=0;
> > > >  int min_B=row-1;
> > > >  for ( unsigned l=0;l<B.size();l++)
> > > >        {
> > > >                if(max_B < B.at(l))
> > > >                max_B=B.at(l);
> > > >                if(min_B > B.at(l))
> > > >                min_B=B.at(l);
> > > >        }
>
> > > >  for (int j=min_B;j<max_B;j++)
> > > >   {   cout<<Array[i][j];
> > > >   }
> > > > }
>
> > > > cin.get();
> > > > cin.ignore();
> > > > return 0;
> > > > }
>
> > > > And if you have better algorithm to solve the problem then please
> > > > share it here....
>
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "google-codejam" group.
> > > > To post to this group, send email to [email protected].
> > > > To unsubscribe from this group, send email to
> > > > [email protected]<google-code%[email protected]>
> > <google-code%[email protected]<google-code%[email protected]>
>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-code?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "google-codejam" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-code%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-code?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to