11800 - Determine the Shape

All about problems in Volume 118. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

surya ss
New poster
Posts: 22
Joined: Sat Jun 11, 2005 7:31 pm

Re: 11800 - Determine the Shape

Post by surya ss » Thu Jun 09, 2011 4:21 pm

robot wrote:Hi suraya...
For ur input my accepted output is given...
Case 1: Square
Case 2: Rectangle
Case 3: Rhombus
Case 4: Parallelogram
Case 5: Trapezium
Case 6: Ordinary Quadrilateral
Case 7: Ordinary Quadrilateral
Case 8: Ordinary Quadrilateral
Case 9: Trapezium
Case 10: Parallelogram
Case 11: Trapezium
Case 12: Trapezium
Case 13: Square
may be some output don't match like me...
I think ur Trapezium condition exactly not right..
if u check parallel , u can use simply vector Cross Product...if Cross product is zero , then parallel , otherwise not..
ASU(SUST) :)
Thank you for the help
at last I ACed it
The problem was in check the parallel and remove the check of all four side must be different

cegonya19
New poster
Posts: 1
Joined: Thu Jun 16, 2011 2:36 am

Re: 11800 - Determine the Shape

Post by cegonya19 » Thu Jun 16, 2011 2:45 am

Hi I'm getting WA.
How do you sort points? My sort is wrong!
Can someone help me?
This is my code:

Code: Select all


#include <math.h>
#include <stdio.h>
#include <algorithm>

using namespace std;

double lado(int x1, int y1, int x2, int y2){
   return sqrt(pow(x2-x1,2)+pow(y2-y1,2));
}

double angle(int x1,int y1,int x2,int y2,int x3,int y3){
   int a = x2 - x1;
   int b = y2 - y1;
   int c = x3 - x2;
   int d = y3 - y2;
   double numerador = (a*c + b*d);
   double value = 0;
   if(numerador != 0.0)
      value = numerador/sqrt((a*a+b*b)*(c*c+d*d));
   return acos(value)*180/M_PI;
}

double pendiente(int x1, int y1, int x2, int y2){
   return ((y2-y1)*1.0)/(x2-x1);
}



int main()
{
   freopen("in.txt","rt",stdin);
   freopen("out.txt","wt",stdout);

   int valores[4][2];
   double angles[4];
   double lados[4];
   double pendientes[4];
   int t;
   scanf("%d\n",&t);
   for(int k=1;k<=t;k++){
      int indices[4]={0,1,2,3};
      for(int i=0;i<4;i++)
         scanf("%d %d\n",&valores[i][0],&valores[i][1]);
      int m =0;
      do{
         //double sum = 0;
         angles[0] = angle(valores[indices[0]][0],valores[indices[0]][1],valores[indices[1]][0],valores[indices[1]][1],valores[indices[2]][0],valores[indices[2]][1]);
         angles[1] = angle(valores[indices[1]][0],valores[indices[1]][1],valores[indices[2]][0],valores[indices[2]][1],valores[indices[3]][0],valores[indices[3]][1]);
         angles[2] = angle(valores[indices[2]][0],valores[indices[2]][1],valores[indices[3]][0],valores[indices[3]][1],valores[indices[0]][0],valores[indices[0]][1]);
         angles[3] = angle(valores[indices[3]][0],valores[indices[3]][1],valores[indices[0]][0],valores[indices[0]][1],valores[indices[1]][0],valores[indices[1]][1]);
         if(angles[0]+angles[1]+angles[2]+angles[3]==360.0)
            break;

      }while(next_permutation(indices,indices+4));


      lados[0] = lado(valores[indices[0]][0],valores[indices[0]][1],valores[indices[1]][0],valores[indices[1]][1]);
      lados[1] = lado(valores[indices[1]][0],valores[indices[1]][1],valores[indices[2]][0],valores[indices[2]][1]);
      lados[2] = lado(valores[indices[2]][0],valores[indices[2]][1],valores[indices[3]][0],valores[indices[3]][1]);
      lados[3] = lado(valores[indices[3]][0],valores[indices[3]][1],valores[indices[0]][0],valores[indices[0]][1]);

      printf("Case %d: ",k);

      if(lados[0]==lados[1] && lados[1]==lados[2] && lados[2]==lados[3]){
          if(angles[0]==angles[1] && angles[1]==angles[2] && angles[2]==angles[3] && angles[3]==90.0)
             printf("Square\n");
          else
             printf("Rhombus\n");

      }else{
          if(lados[0]==lados[2] && lados[1]==lados[3]){
             if(angles[0]==angles[1] && angles[1]==angles[2] && angles[2]==angles[3] && angles[3]==90.0)
                printf("Rectangle\n");
             else
                printf("Parallelogram\n");
          }else{
             pendientes[0] = pendiente(valores[indices[0]][0],valores[indices[0]][1],valores[indices[1]][0],valores[indices[1]][1]);
             pendientes[1] = pendiente(valores[indices[1]][0],valores[indices[1]][1],valores[indices[2]][0],valores[indices[2]][1]);
             pendientes[2] = pendiente(valores[indices[2]][0],valores[indices[2]][1],valores[indices[3]][0],valores[indices[3]][1]);
             pendientes[3] = pendiente(valores[indices[3]][0],valores[indices[3]][1],valores[indices[0]][0],valores[indices[0]][1]);
             if((pendientes[0]==pendientes[2] && pendientes[1]!=pendientes[3])||(pendientes[0]!=pendientes[2] && pendientes[1]==pendientes[3]))
                printf("Trapezium\n");
             else
                printf("Ordinary Quadrilateral\n");
          }
      }

   }
   return 0;
}
//---------------------------------------------------------------------------


Gabrielwer
New poster
Posts: 6
Joined: Thu Sep 08, 2011 12:27 pm

Re: 11800 - Determine the Shape

Post by Gabrielwer » Tue Oct 25, 2011 11:31 am

Hi) I followed the advice of the simplest approach and sort the four position using ccw sorting by cross now everything is ok :D

sumit saha shawon
New poster
Posts: 19
Joined: Tue Jun 26, 2012 9:19 pm

Re: 11800 - Determine the Shape

Post by sumit saha shawon » Mon Jul 09, 2012 8:51 pm

what is wrong with my algorithn
my code:

Code: Select all

#include<stdio.h>
int main()
{
    int t,kase;
    scanf("%d",&t);
    for(kase=1; kase<=t; kase++)
    {
        int x1,y1,x2,y2,x3,y3,x4,y4;
        scanf("%d %d",&x1,&y1);
        scanf("%d %d",&x2,&y2);
        scanf("%d %d",&x3,&y3);
        scanf("%d %d",&x4,&y4);
        //if()
        int a,b,c,d,m,n;
        a=((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2));
        b=((x3-x2)*(x3-x2))+((y3-y2)*(y3-y2));
        c=((x4-x3)*(x4-x3))+((y4-y3)*(y4-y3));
        d=((x1-x4)*(x1-x4))+((y1-y4)*(y1-y4));
        m=((x3-x1)*(x3-x1))+((y3-y1)*(y3-y1));
        n=((x4-x2)*(x4-x2))+((y4-y2)*(y4-y2));
        int temp;
       if(a>m)
       {
           temp=a;
           a=m;
           m=temp;
       }
       if(b>m)
       {
           temp=b;
           b=m;
           m=b;
       }
       if(a==b&&(m==(a+b)))
       {
           printf("Case %d: Square\n",kase);
       }
       else if(a!=b&&(m==(a+b)))
       printf("Case %d: Rectangle\n",kase);
       else if(a==b&&(m!=(a+b)))
       printf("Case %d: Rhombus\n",kase);
       else if((m!=(a+b))&&((a==b)||(a==c)||(a==d)||(a==n)))
       printf("Case %d: Parallelogram\n",kase);
       else if(((x1==x2)&&(x3==x4))||((x1==x3)&&(x2==x4))||((x1==x4)&&(x2==x3))||((y1==y2)&&(y3==y4))||((y1==y3)&&(y2==y4))||((y1==y4)&&(y2==y3)))
       printf("Case %d: Trapezium\n",kase);

       else
       printf("Case %d: Ordinary Quadrilateral\n",kase);

    }
    return 0;
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11800 - Determine the Shape

Post by brianfry713 » Tue Jul 17, 2012 11:52 pm

Doesn't match the sample I/O.
Check input and AC output for thousands of problems on uDebug!

sumit saha shawon
New poster
Posts: 19
Joined: Tue Jun 26, 2012 9:19 pm

Re: 11800 - Determine the Shape

Post by sumit saha shawon » Fri Jul 20, 2012 3:02 pm

Please give me a right logic to solve :cry:

liegunawan
New poster
Posts: 2
Joined: Thu Apr 04, 2013 10:17 pm

11800 - Determine the Shape

Post by liegunawan » Thu Apr 04, 2013 10:24 pm

Hi All,

I'm struggling with this problem.

What I've done is, create convex hull from the 4 points to make sure all the point is sorted counter clock wise / clock wise. so i can get the correct order to create the edge.

after that, simple i calculate the angle in each vector and the length of each edge

1. if all edge has the same length then
a. if all the angle in each vector is 90.0 degree, then its Square
b. else, it s a Rhombus
2. if edge[0] == edge[2] and edge[1] == edge[3], means we got 2 pair of same length edge
a. if all the angle in each vector is 90.0 degree, then its Rectangle
b. else, it s a Parallelogram
3. if there's 2 line parallel (i check with the cross product for this)
a. then it's Trapezium
b. else it's Ordinary Quadrilateral

still WA, :(

hope can get any advice or some test case both for the in and out file

liegunawan
New poster
Posts: 2
Joined: Thu Apr 04, 2013 10:17 pm

Re: 11800 - Determine the Shape

Post by liegunawan » Fri Apr 05, 2013 7:29 am

i've tried with the input, my output is different in case 7 and case 12:

points in case 7
1 : -3 0
2 : 0 6
3 : 3 0
4 : 3 0

points in case 12
1 : 1 2
2 : 2 1
3 : 0 0
4 : 0 0

why the accepted output will be Ordinary Quadrilateral for case 7 and Trapezium for case 12 ?

it the same case which is there'are 2 points in the same place

my output for previous test case input

Code: Select all

Case 1: Square
Case 2: Rectangle
Case 3: Rhombus
Case 4: Parallelogram
Case 5: Trapezium
Case 6: Ordinary Quadrilateral
Case 7: Trapezium
Case 8: Ordinary Quadrilateral
Case 9: Trapezium
Case 10: Parallelogram
Case 11: Trapezium
Case 12: Trapezium
Case 13: Square

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11800 - Determine the Shape

Post by brianfry713 » Tue Apr 09, 2013 3:26 am

All 4 points are distinct in the judge's input.
Check input and AC output for thousands of problems on uDebug!

ajmer
New poster
Posts: 7
Joined: Thu Mar 07, 2013 2:16 am

Re: 11800 - Determine the Shape

Post by ajmer » Sat Jun 15, 2013 5:22 am

I'm getting WA even though all of the input I was checking gave the same output as accepted codes. Can someone explain what's wrong or give me some nasty inputs that give wrong outputs? Quick reply would be really appreciated.

Code: Select all

#include <stdio.h>
#include <stdbool.h>

struct point
{
    int x,y;
};

struct odcinek
{
     int ax,ay,bx,by;
};

void odcinki1(struct point *p, struct odcinek *o)
{
    o[0].ax=p[0].x; o[0].ay=p[0].y; o[0].bx=p[1].x; o[0].by=p[1].y;
    o[1].ax=p[1].x; o[1].ay=p[1].y; o[1].bx=p[2].x; o[1].by=p[2].y;
    o[2].ax=p[2].x; o[2].ay=p[2].y; o[2].bx=p[3].x; o[2].by=p[3].y;
    o[3].ax=p[3].x; o[3].ay=p[3].y; o[3].bx=p[0].x; o[3].by=p[0].y;
}

void odcinki3(struct point *p, struct odcinek *o)
{
    o[0].ax=p[0].x; o[0].ay=p[0].y; o[0].bx=p[1].x; o[0].by=p[1].y;
    o[1].ax=p[1].x; o[1].ay=p[1].y; o[1].bx=p[3].x; o[1].by=p[3].y;
    o[2].ax=p[3].x; o[2].ay=p[3].y; o[2].bx=p[2].x; o[2].by=p[2].y;
    o[3].ax=p[2].x; o[3].ay=p[2].y; o[3].bx=p[0].x; o[3].by=p[0].y;
}

void odcinki2(struct point *p, struct odcinek *o)
{
    o[0].ax=p[0].x; o[0].ay=p[0].y; o[0].bx=p[2].x; o[0].by=p[2].y;
    o[1].ax=p[2].x; o[1].ay=p[2].y; o[1].bx=p[1].x; o[1].by=p[1].y;
    o[2].ax=p[1].x; o[2].ay=p[1].y; o[2].bx=p[3].x; o[2].by=p[3].y;
    o[3].ax=p[3].x; o[3].ay=p[3].y; o[3].bx=p[0].x; o[3].by=p[0].y;
}

int length(struct odcinek o)
{
    return (o.ax-o.bx)*(o.ax-o.bx)+(o.ay-o.by)*(o.ay-o.by);
}

bool ase(struct odcinek *o)
{
    if ((length(o[0])==length(o[1]))&&(length(o[0])==length(o[2]))&&(length(o[0])==length(o[3]))) return 1;
    else return 0;
}

bool ose(struct odcinek *o)
{
    if ((length(o[1])==length(o[3]))&&(length(o[2])==length(o[0]))) return 1;
    else return 0;
}

bool pitagoras(struct odcinek d, struct odcinek a, struct odcinek b)
{
    if (length(d)==length(a)+length(b)) return 1;
    else return 0;
}

bool angles(struct odcinek *o)
{
    struct odcinek d1,d2;
    d1.ax=o[0].ax; d1.ay=o[0].ay; d1.bx=o[1].bx; d1.by=o[1].by;
    d2.ax=o[1].ax; d2.ay=o[1].ay; d2.bx=o[2].bx; d2.by=o[2].by;
    if ((pitagoras(d1,o[0],o[1])==1)&&(pitagoras(d1,o[2],o[3])==1)&&(pitagoras(d2,o[1],o[2])==1)&&(pitagoras(d2,o[0],o[3])==1)) return 1;
    else return 0;
}

bool osp(struct odcinek *o)
{
    int a0, a1, a2, a3;
    if (o[0].ax==o[0].bx) a0=10001; else a0=(o[0].ay-o[0].by)*(o[0].ax-o[0].bx);
    if (o[1].ax==o[1].bx) a1=10001; else a1=(o[1].ay-o[1].by)*(o[1].ax-o[1].bx);
    if (o[2].ax==o[2].bx) a2=10001; else a2=(o[2].ay-o[2].by)*(o[2].ax-o[2].bx);
    if (o[3].ax==o[3].bx) a3=10001; else a3=(o[3].ay-o[3].by)*(o[3].ax-o[3].bx);
    if ((a0==a2)||(a1==a3)) return 1;
    else return 0;

}

void result(struct odcinek *o, int i)
{
    if ((ase(o)==1)&&(angles(o)==1)) printf("Case %d: Square\n",i);
    else if (ase(o)==1) printf("Case %d: Rhombus\n",i);
    else if ((ose(o)==1)&&(angles(o)==1)) printf("Case %d: Rectangle\n",i);
    else if (ose(o)==1) printf("Case %d: Parallelogram\n",i);
    else if (osp(o)==1) printf("Case %d: Trapezium\n",i);
    else printf("Case %d: Ordinary Quadrilateral\n",i);
}

int main()
{
    int n,i,j,sum1,sum2,sum3;
    struct point p[4];
    struct odcinek o[4];
    scanf("%d",&n);
    for (i=1;i<=n;i++)
    {
        for (j=0;j<4;j++) scanf("%d %d",&p[j].x,&p[j].y);
        odcinki1(p,o);
        sum1=length(o[0])+length(o[1])+length(o[2])+length(o[3]);
        odcinki2(p,o);
        sum2=length(o[0])+length(o[1])+length(o[2])+length(o[3]);
        odcinki3(p,o);
        sum3=length(o[0])+length(o[1])+length(o[2])+length(o[3]);
        if (((sum1<=sum2)&&(sum1<=sum3))||((sum2<0)&&(sum3<0))) odcinki1(p,o);
        else if ((sum2<=sum3)||(sum3<0)) odcinki2(p,o);
        else odcinki3(p,o);
        result(o,i);
    }
    return 0;
}

Drathus
New poster
Posts: 3
Joined: Wed Apr 09, 2014 5:13 am

11800 - Determine The Shape

Post by Drathus » Wed Apr 09, 2014 5:16 am

Hi Everyone,
I've been working on problem 11800. My code works like this:
Look for a set of parallel edges
Cant find -> ordinary
Can find -> look for second
Can't find second - > trapezium
Then obvious calculations for the other 4 shapes

It works with every test case I can think of. Any suggestions?

Code: Select all

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

struct pt{
    double x, y;
};

pt p[4];

double dist(int p1, int p2){
    int dx = (p[p2].x - p[p1].x), dy = (p[p2].y - p[p1].y);
    dx *= dx; dy *= dy;
    return sqrt(dx + dy);
}

double slope(int p1, int p2){
    double s = (p[p2].y - p[p1].y) * 1.0 / (p[p2].x - p[p1].x);
    if (s == -0) return 0;
    return s;
}

bool vert(int p1, int p2){
    return p[p1].x == p[p2].x;
}

int main(){
    int t;
    cin >> t;
    for(int cases = 1; cases <= t; cases++){
        for(int j = 0; j < 4; j++){
            cin >> p[j].x >> p[j].y;
        }
        int p11, p12, p21, p22;
        bool f = false;
        for(int i = 0; i < 4 && !f; i++){
            for(int j = i + 1; j < 4 && !f; j++){
                bool vert1 = vert(i, j);
                //cout << i << " " << j << endl;
                for(int x = 0; x < 4 && !f; x++){ //Find first set of parallell lines
                    for(int y = x + 1; y < 4 && !f; y++){
                        if(x == i || x == j || y == i || y == j) continue;
                        bool vert2 = vert(x, y);
                        //cout << "\t" << x << " " << y << endl;
                        //cout << "\t\t" << slope(i, j) << " " << slope(x, y) << endl;
                        if(vert1 || vert2){
                            if(vert1 && vert2){
                                p11 = i; p12 = j;
                                p21 = x; p22 = y;
                                f = true;
                            }
                            continue;
                        }
                        else if(slope(i, j) == slope(x, y)){
                            p11 = i; p12 = j;
                            p21 = x; p22 = y;
                            f = true;
                        }
                    }
                }
            }
        }

        //cout << "Slopes: " << slope(0, 1) << " " << slope(2, 3) << endl;
        //cout << p11 << " " << p12 << endl << p21 << " " << p22 << endl;
        if(!f){
            cout << "Case " << cases << ": Ordinary Quadrilateral" << endl;
            continue;
        }

        //cout << p11 << " " << p12 << endl << p21 << " " << p22 << endl;

        f = false;
        int p31, p32, p41, p42;
        if(vert(p11, p21) || vert(p22, p12)){
            if(vert(p11, p21) && vert(p22, p12)){
                p31 = p11; p32 = p21;
                p41 = p22; p42 = p12;
                f = true;
            }
        }
        else if(slope(p11, p21) == slope(p22, p12)){
            p31 = p11; p32 = p21;
            p41 = p22; p42 = p12;
            f = true;
        }

        if(vert(p11, p22) || vert(p21, p12)){
            if(vert(p11, p22) && vert(p21, p12)){
                p31 = p11; p32 = p22;
                p41 = p21; p42 = p12;
                f = true;
            }
        }
        else if(slope(p11, p22) == slope(p21, p12)){
            p31 = p11; p32 = p22;
            p41 = p21; p42 = p12;
            f = true;
        }

        if(!f){
            cout << "Case " << cases << ": Trapezium" << endl;
            continue;
        }
        double sl = dist(p11, p12);
        if(slope(p11, p12) != -1.0 / slope(p31, p32)){ //Rhombus/Parallelogram
            if(sl != dist(p21, p22) || sl != dist(p31, p32) || sl != dist(p41, p42)){
                cout << "Case " << cases << ": Parallelogram" << endl;
            }
            else cout << "Case " << cases << ": Rhombus" << endl;
        }
        else{ //Square/Rectangle
            if(sl != dist(p21, p22) || sl != dist(p31, p32) || sl != dist(p41, p42)){
                cout << "Case " << cases << ": Rectangle" << endl;
            }
            else cout << "Case " << cases << ": Square" << endl;
        }
    }
}


brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11800 - Determine The Shape

Post by brianfry713 » Wed Apr 09, 2014 9:03 pm

Input:

Code: Select all

144
0 0
2 0
2 2
0 2
0 0
2 0
0 2
2 2
0 0
2 2
2 0
0 2
0 0
2 2
0 2
2 0
0 0
0 2
2 0
2 2
0 0
0 2
2 2
2 0
2 0
0 0
2 2
0 2
2 0
0 0
0 2
2 2
2 0
2 2
0 0
0 2
2 0
2 2
0 2
0 0
2 0
0 2
0 0
2 2
2 0
0 2
2 2
0 0
2 2
0 0
2 0
0 2
2 2
0 0
0 2
2 0
2 2
2 0
0 0
0 2
2 2
2 0
0 2
0 0
2 2
0 2
0 0
2 0
2 2
0 2
2 0
0 0
0 2
0 0
2 0
2 2
0 2
0 0
2 2
2 0
0 2
2 0
0 0
2 2
0 2
2 0
2 2
0 0
0 2
2 2
0 0
2 0
0 2
2 2
2 0
0 0
0 0
3 0
3 2
0 2
0 0
3 0
0 2
3 2
0 0
3 2
3 0
0 2
0 0
3 2
0 2
3 0
0 0
0 2
3 0
3 2
0 0
0 2
3 2
3 0
3 0
0 0
3 2
0 2
3 0
0 0
0 2
3 2
3 0
3 2
0 0
0 2
3 0
3 2
0 2
0 0
3 0
0 2
0 0
3 2
3 0
0 2
3 2
0 0
3 2
0 0
3 0
0 2
3 2
0 0
0 2
3 0
3 2
3 0
0 0
0 2
3 2
3 0
0 2
0 0
3 2
0 2
0 0
3 0
3 2
0 2
3 0
0 0
0 2
0 0
3 0
3 2
0 2
0 0
3 2
3 0
0 2
3 0
0 0
3 2
0 2
3 0
3 2
0 0
0 2
3 2
0 0
3 0
0 2
3 2
3 0
0 0
0 0
8 4
5 0
3 4
0 0
8 4
3 4
5 0
0 0
5 0
8 4
3 4
0 0
5 0
3 4
8 4
0 0
3 4
8 4
5 0
0 0
3 4
5 0
8 4
8 4
0 0
5 0
3 4
8 4
0 0
3 4
5 0
8 4
5 0
0 0
3 4
8 4
5 0
3 4
0 0
8 4
3 4
0 0
5 0
8 4
3 4
5 0
0 0
5 0
0 0
8 4
3 4
5 0
0 0
3 4
8 4
5 0
8 4
0 0
3 4
5 0
8 4
3 4
0 0
5 0
3 4
0 0
8 4
5 0
3 4
8 4
0 0
3 4
0 0
8 4
5 0
3 4
0 0
5 0
8 4
3 4
8 4
0 0
5 0
3 4
8 4
5 0
0 0
3 4
5 0
0 0
8 4
3 4
5 0
8 4
0 0
0 0
2 0
3 2
1 2
0 0
2 0
1 2
3 2
0 0
3 2
2 0
1 2
0 0
3 2
1 2
2 0
0 0
1 2
2 0
3 2
0 0
1 2
3 2
2 0
2 0
0 0
3 2
1 2
2 0
0 0
1 2
3 2
2 0
3 2
0 0
1 2
2 0
3 2
1 2
0 0
2 0
1 2
0 0
3 2
2 0
1 2
3 2
0 0
3 2
0 0
2 0
1 2
3 2
0 0
1 2
2 0
3 2
2 0
0 0
1 2
3 2
2 0
1 2
0 0
3 2
1 2
0 0
2 0
3 2
1 2
2 0
0 0
1 2
0 0
2 0
3 2
1 2
0 0
3 2
2 0
1 2
2 0
0 0
3 2
1 2
2 0
3 2
0 0
1 2
3 2
0 0
2 0
1 2
3 2
2 0
0 0
0 0
5 0
4 3
1 3
0 0
5 0
1 3
4 3
0 0
4 3
5 0
1 3
0 0
4 3
1 3
5 0
0 0
1 3
5 0
4 3
0 0
1 3
4 3
5 0
5 0
0 0
4 3
1 3
5 0
0 0
1 3
4 3
5 0
4 3
0 0
1 3
5 0
4 3
1 3
0 0
5 0
1 3
0 0
4 3
5 0
1 3
4 3
0 0
4 3
0 0
5 0
1 3
4 3
0 0
1 3
5 0
4 3
5 0
0 0
1 3
4 3
5 0
1 3
0 0
4 3
1 3
0 0
5 0
4 3
1 3
5 0
0 0
1 3
0 0
5 0
4 3
1 3
0 0
4 3
5 0
1 3
5 0
0 0
4 3
1 3
5 0
4 3
0 0
1 3
4 3
0 0
5 0
1 3
4 3
5 0
0 0
0 0
5 0
4 3
1 4
0 0
5 0
1 4
4 3
0 0
4 3
5 0
1 4
0 0
4 3
1 4
5 0
0 0
1 4
5 0
4 3
0 0
1 4
4 3
5 0
5 0
0 0
4 3
1 4
5 0
0 0
1 4
4 3
5 0
4 3
0 0
1 4
5 0
4 3
1 4
0 0
5 0
1 4
0 0
4 3
5 0
1 4
4 3
0 0
4 3
0 0
5 0
1 4
4 3
0 0
1 4
5 0
4 3
5 0
0 0
1 4
4 3
5 0
1 4
0 0
4 3
1 4
0 0
5 0
4 3
1 4
5 0
0 0
1 4
0 0
5 0
4 3
1 4
0 0
4 3
5 0
1 4
5 0
0 0
4 3
1 4
5 0
4 3
0 0
1 4
4 3
0 0
5 0
1 4
4 3
5 0
0 0
AC output:

Code: Select all

Case 1: Square
Case 2: Square
Case 3: Square
Case 4: Square
Case 5: Square
Case 6: Square
Case 7: Square
Case 8: Square
Case 9: Square
Case 10: Square
Case 11: Square
Case 12: Square
Case 13: Square
Case 14: Square
Case 15: Square
Case 16: Square
Case 17: Square
Case 18: Square
Case 19: Square
Case 20: Square
Case 21: Square
Case 22: Square
Case 23: Square
Case 24: Square
Case 25: Rectangle
Case 26: Rectangle
Case 27: Rectangle
Case 28: Rectangle
Case 29: Rectangle
Case 30: Rectangle
Case 31: Rectangle
Case 32: Rectangle
Case 33: Rectangle
Case 34: Rectangle
Case 35: Rectangle
Case 36: Rectangle
Case 37: Rectangle
Case 38: Rectangle
Case 39: Rectangle
Case 40: Rectangle
Case 41: Rectangle
Case 42: Rectangle
Case 43: Rectangle
Case 44: Rectangle
Case 45: Rectangle
Case 46: Rectangle
Case 47: Rectangle
Case 48: Rectangle
Case 49: Rhombus
Case 50: Rhombus
Case 51: Rhombus
Case 52: Rhombus
Case 53: Rhombus
Case 54: Rhombus
Case 55: Rhombus
Case 56: Rhombus
Case 57: Rhombus
Case 58: Rhombus
Case 59: Rhombus
Case 60: Rhombus
Case 61: Rhombus
Case 62: Rhombus
Case 63: Rhombus
Case 64: Rhombus
Case 65: Rhombus
Case 66: Rhombus
Case 67: Rhombus
Case 68: Rhombus
Case 69: Rhombus
Case 70: Rhombus
Case 71: Rhombus
Case 72: Rhombus
Case 73: Parallelogram
Case 74: Parallelogram
Case 75: Parallelogram
Case 76: Parallelogram
Case 77: Parallelogram
Case 78: Parallelogram
Case 79: Parallelogram
Case 80: Parallelogram
Case 81: Parallelogram
Case 82: Parallelogram
Case 83: Parallelogram
Case 84: Parallelogram
Case 85: Parallelogram
Case 86: Parallelogram
Case 87: Parallelogram
Case 88: Parallelogram
Case 89: Parallelogram
Case 90: Parallelogram
Case 91: Parallelogram
Case 92: Parallelogram
Case 93: Parallelogram
Case 94: Parallelogram
Case 95: Parallelogram
Case 96: Parallelogram
Case 97: Trapezium
Case 98: Trapezium
Case 99: Trapezium
Case 100: Trapezium
Case 101: Trapezium
Case 102: Trapezium
Case 103: Trapezium
Case 104: Trapezium
Case 105: Trapezium
Case 106: Trapezium
Case 107: Trapezium
Case 108: Trapezium
Case 109: Trapezium
Case 110: Trapezium
Case 111: Trapezium
Case 112: Trapezium
Case 113: Trapezium
Case 114: Trapezium
Case 115: Trapezium
Case 116: Trapezium
Case 117: Trapezium
Case 118: Trapezium
Case 119: Trapezium
Case 120: Trapezium
Case 121: Ordinary Quadrilateral
Case 122: Ordinary Quadrilateral
Case 123: Ordinary Quadrilateral
Case 124: Ordinary Quadrilateral
Case 125: Ordinary Quadrilateral
Case 126: Ordinary Quadrilateral
Case 127: Ordinary Quadrilateral
Case 128: Ordinary Quadrilateral
Case 129: Ordinary Quadrilateral
Case 130: Ordinary Quadrilateral
Case 131: Ordinary Quadrilateral
Case 132: Ordinary Quadrilateral
Case 133: Ordinary Quadrilateral
Case 134: Ordinary Quadrilateral
Case 135: Ordinary Quadrilateral
Case 136: Ordinary Quadrilateral
Case 137: Ordinary Quadrilateral
Case 138: Ordinary Quadrilateral
Case 139: Ordinary Quadrilateral
Case 140: Ordinary Quadrilateral
Case 141: Ordinary Quadrilateral
Case 142: Ordinary Quadrilateral
Case 143: Ordinary Quadrilateral
Case 144: Ordinary Quadrilateral
Check input and AC output for thousands of problems on uDebug!

JohnTortugo
New poster
Posts: 18
Joined: Sun Jul 20, 2008 7:05 pm

Re: 11800 - Determine The Shape

Post by JohnTortugo » Fri May 09, 2014 10:50 pm

Anyone have more test cases?

brianfry713, my code passes all your test cases but gets WA from the judge =( , do you have any input with corner case?

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11800 - Determine The Shape

Post by brianfry713 » Sun May 11, 2014 1:31 am

Post or PM me your code.
Check input and AC output for thousands of problems on uDebug!

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11800 - Determine The Shape

Post by brianfry713 » Mon May 12, 2014 10:11 pm

Try solving it without using floating point.
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 118 (11800-11899)”