Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

没有考虑相对位置 居然也过了 排序 N*long(N) 2200ms 飘过

Posted by mathcrazy at 2010-11-19 11:17:32 on Problem 3349
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct snow{
  int a[6];
  bool operator <(const snow k) const
  {
      for(int i=0;i<6;i++)
        if(a[i]!=k.a[i]) return a[i]<k.a[i];
      return true;
  }
}s[100001];
bool comp(const snow s1,const snow s2)
{
    for(int i=0;i<6;i++)
       if(s1.a[i] !=s2.a[i]) return false;
    return true;
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
       for(int j=0;j<6;j++)
            scanf("%d",&s[i].a[j]);
       sort(s[i].a,s[i].a+6);
    }
    sort(s,s+n);
    for(int i=0;i<n-1;i++)
      {
        if(comp(s[i],s[i+1]))
          {
              printf("Twin snowflakes found.\n");
              return 0;
          }
      }
    printf("No two snowflakes are alike.\n");
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator