Submission #573532


Source Code Expand

#include<bits/stdc++.h>
#include<tr1/unordered_map>
using namespace std;
#define mp make_pair
#define f first
#define s second

map <pair<ll, ll>, int> m;

int n;
int ans[4];
pair<ll, ll> p[1111];

int main()
{
  cin >> n;
  for(int i = 1; i <= n; i++)
  {
    scanf("%lld%lld", &p[i].f, &p[i].s);
    m[p[i]] = i;
  }

  int flag = 0;
  for(int i = 1; i <= n; i++)
  {
    for(int j = 1; j <= n; j++)
    {
      if(i == j) continue;
      pair<ll, ll> vec1 = mp(p[j].f - p[i].f, p[j].s - p[i].s), vec2 = mp(p[i].f - p[j].f, p[i].s - p[j].s);
      pair<ll, ll> t1 = mp(p[i].f - vec1.s, p[i].s + vec1.f), t2 = mp(p[j].f + vec2.s, p[j].s - vec2.f);
      int q1 = m[t1], q2 = m[t2];
      if(q1 && q2)
      {
        ans[0] = q1;
        ans[1] = q2;
        ans[2] = i, ans[3] = j;
        sort(ans, ans + 4);
        printf("4\n");
        for(int k = 0; k < 4; k++) printf("%d\n", ans[k]);
        flag = 1;
      }
      if(flag) break;
      pair<ll, ll> t3 = mp(p[j].f - vec1.s, p[j].s + vec1.f) , t4 = mp(p[i].f + vec2.s, p[i].s - vec2.f);
      int q3 = m[t3], q4 = m[t4];
      if(q3 && q4)
      {
        ans[0] = q3;
        ans[1] = q4;
        ans[2] = i, ans[3] = j;
        sort(ans, ans + 4);
        printf("4\n");
        for(int k = 0; k < 4; k++) printf("%d\n", ans[k]);
        flag = 1;
      }
      if(flag) break;
    }
    if(flag) break;
  }
  if(!flag) puts("0");
  return 0;
}

Submission Info

Submission Time
Task C - Regular Polygon
User gorodan
Language C++ (G++ 4.6.4)
Score 0
Code Size 1469 Byte
Status CE

Compile Error

./Main.cpp:8:11: error: ‘ll’ was not declared in this scope
./Main.cpp:8:15: error: ‘ll’ was not declared in this scope
./Main.cpp:8:17: error: template argument 1 is invalid
./Main.cpp:8:17: error: template argument 2 is invalid
./Main.cpp:8:23: error: template argument 1 is invalid
./Main.cpp:8:23: error: template argument 3 is invalid
./Main.cpp:8:23: error: template argument 4 is invalid
./Main.cpp:8:26: error: invalid type in declaration before ‘;’ token
./Main.cpp:12:6: error: ‘ll’ was not declared in this scope
./Main.cpp:12:10: error: ‘ll’ was not declared in this scope
./Main.cpp:12:12: error: template argument 1 is invalid
./Main.cpp:12:12: error: template argument 2 is invalid
./Main.cpp:12:21: error: invalid type in declaration before ‘;’ token
./Main.cpp: In function ‘int main()’:
./Main.cpp:19:29: error: request for member ‘first’ in ‘p[i]’, which is of non-class type ‘int’
./Main.cpp:19:38: error: request for member ‘second’ in ‘p[i]’, which is of...