CodeForces 733D Kostya the Sculptor
排序。把每一个长方体拆成$6$个做,然后排序做即可。
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<ctime>
#include<iostream>
using namespace std;
typedef long long LL;
const double pi=acos(-1.0);
void File()
{
freopen("D:\\in.txt","r",stdin);
freopen("D:\\out.txt","w",stdout);
}
template <class T>
inline void read(T &x)
{
char c = getchar();
x = ;
while(!isdigit(c)) c = getchar();
while(isdigit(c))
{
x = x * + c - '';
c = getchar();
}
} struct X
{
int a,b,c,id;
}s[],t[];
int n,sz; void add(int A,int B,int C,int ID)
{
s[sz].a=A;
s[sz].b=B;
s[sz].c=C;
s[sz].id=ID;
sz++;
} bool F(int x,int y)
{
if(s[x].a!=s[y].a) return ;
if(s[x].b!=s[y].b) return ;
if(s[x].c!=s[y].c) return ;
if(s[x].id!=s[y].id) return ;
return ;
} bool cmp(X a,X b)
{
if(a.a!=b.a) return a.a<b.a;
if(a.b!=b.b) return a.b<b.b;
if(a.c!=b.c) return a.c<b.c;
return a.id<b.id;
} int main()
{
cin>>n;
for(int i=;i<=n;i++)
{
int a,b,c; cin>>a>>b>>c;
add(a,b,c,i); add(b,a,c,i);
add(a,c,b,i); add(c,a,b,i);
add(b,c,a,i); add(c,b,a,i);
} sort(s,s+sz,cmp); sz=; t[sz++]=s[];
for(int i=;i<*n;i++)
{
if(F(i,i-)==) continue;
t[sz++]=s[i];
}
/*
for(int i=0;i<sz;i++)
{
printf("%d %d %d %d\n",t[i].a,t[i].b,t[i].c,t[i].id);
}
*/ int mx=,ans1,ans2,ans3; for(int i=;i<sz;i++)
{
if(min(t[i].a,min(t[i].b,t[i].c))>mx)
{
mx=min(t[i].a,min(t[i].b,t[i].c));
ans1=; ans2=t[i].id;
} if(i>=&&t[i].a==t[i-].a&&t[i].b==t[i-].b)
{
if(min(t[i].a,min(t[i].b,t[i].c+t[i-].c))>mx)
{
mx=min(t[i].a,min(t[i].b,t[i].c+t[i-].c));
ans1=; ans2=t[i].id; ans3=t[i-].id;
}
}
} if(ans1==) printf("1\n%d\n",ans2);
else printf("2\n%d %d\n",ans2,ans3); return ;
}
CodeForces 733D Kostya the Sculptor的更多相关文章
- codeforces 733D Kostya the Sculptor(贪心)
Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. K ...
- Codeforces Round #378 (Div. 2) D - Kostya the Sculptor
Kostya the Sculptor 这次cf打的又是心累啊,果然我太菜,真的该认真学习,不要随便的浪费时间啦 [题目链接]Kostya the Sculptor &题意: 给你n个长方体, ...
- Codeforces Round #378 (Div. 2) D. Kostya the Sculptor map+pair
D. Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input stand ...
- Kostya the Sculptor
Kostya the Sculptor 题目链接:http://codeforces.com/problemset/problem/733/D 贪心 以次小边为第一关键字,最大边为第二关键字,最小边为 ...
- CF733D Kostya the Sculptor[贪心 排序]
D. Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input stand ...
- Codeforces378 D Kostya the Sculptor(贪心)(逻辑)
Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input standard ...
- 【25.47%】【codeforces 733D】Kostya the Sculptor
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- Codeforces Round #378 (Div. 2) D. Kostya the Sculptor 分组 + 贪心
http://codeforces.com/contest/733/problem/D 给定n个长方体,然后每个长方体都能选择任何一个面,去和其他长方体接在一起,也可以自己一个,要求使得新的长方体的最 ...
- [CF733D]Kostya the Sculptor(贪心)
题目链接:http://codeforces.com/contest/733/problem/D 题意:给n个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少 ...
随机推荐
- Lucene6.6添加索引数据时字符个数超限,字符数不能超过BYTE_BLOCK_SIZE=32766
最近发现Lucene6.6版本添加索引数据字符数超过32766时,出现报错,而Lucene4.6版本中则未出现这一问题,原因如下: 概述: 添加索引数据时,对于分词字段,分词后的Ter ...
- Asp.Net Web Forms/MVC/Console App中使用Autofac
本来简单介绍了Autofac在Asp.Net Web Forms中的应用,后来又添加了mvc.控制台应用程序中使用Autofac,详情请看源码. ASP.NET Web Forms使用Autofac, ...
- webpack_配置和使用教程
webpack是一个模块打包的工具,它的作用是把互相依赖的模块处理成静态资源. webpack 可以使用 loader 来预处理文件.这允许你打包除 JavaScript 之外的任何静态资源.你可以使 ...
- js_在原有的日期上添加天数输出添加后的日期
开始编码工作也有段时间了,想想没有留下点什么,有点遗憾.学到的一些经验,写写,分享一下.也给自己整理一下. 今天分享一下,在原有的日期上添加天数输出添加后的日期.开始做的时候,简单的思路是,直接用ne ...
- 1.0 docker介绍
简介: 一种虚拟化的方案 将应用程序自动部署到容器 特点: 轻量 环境的一直性 提高开发生命周期 使用面向服务的架构 场景: 开发.测试.部署 创建隔离的运行环境 集群测试环境 云计算应用 ...
- linux系统引导流程
1.固件:硬件和软件结合.加电自检是我们按下电源会检测硬件像cpu.内存.网卡等信息.(从硬件层次检测硬件是否可用) 固件设置实例:设置时间 软件时间和硬件时间: [root@VM_0_12_cent ...
- Eudyptula Challenge
http://www.eudyptula-challenge.org/ The Eudyptula Challenge What is it? The Eudyptula Challenge is a ...
- 安全测试===sqlmap(零)转载
本文转自:https://blog.werner.wiki/sqlmap-study-notes-0/ 感谢作者的整理,如有侵权,立删 零.前言 这篇文章是我学习Sqlmap的用法时做的笔记,记录了S ...
- 开源网络准入系统(open source Network Access Control system)
开源网络准入系统(open source Network Access Control system) http://blog.csdn.net/achejq/article/details/5108 ...
- 解析jsp的 tomcat 、resin
一.tomcat 1. 安装JDK [root@localhost ~]# cd /usr/local/src/ [root@localhost src]# wget http://www.lishi ...