Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
没有考虑相对位置 居然也过了 排序 N*long(N) 2200ms 飘过#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator