C++-POJ3349-Snowflake Snow Snowflakes[STL][set][hash未写]
2024-09-06 23:12:53
错误AC解法,sort+set判重,为考虑异构!
比较坑的一点是读入时scanf一定要一次读6个数,不然会TLE
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
struct node{
int a,b,c,d,e,f,hash;
node(int a,int b,int c,int d,int e,int f):a(a),b(b),c(c),d(d),e(e),f(f){}
bool operator<(const node&x)const{
if(a==x.a&&b==x.b&&c==x.c&&d==x.d&&e==x.e)return f<x.f;
if(a==x.a&&b==x.b&&c==x.c&&d==x.d)return e<x.e;
if(a==x.a&&b==x.b&&c==x.c)return d<x.d;
if(a==x.a&&b==x.b)return c<x.c;
if(a==x.a)return b<x.b;
return a<x.a;
}
};
set<node>s;
int n,l[]; int main(){
scanf("%d",&n);
for(int i=;i<=n;i++){
scanf("%d%d%d%d%d%d",&l[],&l[],&l[],&l[],&l[],&l[]),sort(l,l+);
node snow=node(l[],l[],l[],l[],l[],l[]);
if(s.find(snow)!=s.end()){puts("Twin snowflakes found.");return ;}
s.insert(snow);
}
puts("No two snowflakes are alike.");
return ;
}
最新文章
- js jQuery取消添加超链接的方法小结
- eclipse控台不见
- KeyValue与KeyData与KeyCode区别(转)
- phpMyAdmin 登陆需要密码
- CSS之column语法
- PHP程序员衰老后的下场
- 修改linux多系统启动顺序
- Android + OpenCV - Finding extreme points in contours
- css的背景background的相关属性
- node.js之模块
- A* a=new B ,会不会产生内存泄露了,露了B-A的部分?
- 深度解密HTTP通信细节
- Node.js 应用:Koa2 使用 JWT 进行鉴权
- Hibernate 5 入门指南-基于JPA
- C - Alphabetic Removals
- [LeetCode] 系统刷题3_Binary search
- SDP服务搜索流程源码分析
- LRU缓存原理
- c# base64算法解密
- Java线程的阻塞
热门文章
- Linux环境搭建及基础操作
- git提交时忽略了dll
- C++ STL:next_permutation和prev_permutation
- SAP 登录Fiori的user和登录WEB UI的business role之间的关系。
- centos6离线安装apache2.4
- 我的第一个Maven Helloworld
- 2.Ubuntu安装 Docker
- Appium+python自动化-Android夜神模拟器
- LINUX使用SSH远程终端时,如何将运行时间长的程序在后台挂起,下次SSH登陆时继续使用同一个SHELL?
- thinkphp中如何用路由调用前台html界面