排序。把每一个长方体拆成$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的更多相关文章

  1. 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 ...

  2. Codeforces Round #378 (Div. 2) D - Kostya the Sculptor

    Kostya the Sculptor 这次cf打的又是心累啊,果然我太菜,真的该认真学习,不要随便的浪费时间啦 [题目链接]Kostya the Sculptor &题意: 给你n个长方体, ...

  3. 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 ...

  4. Kostya the Sculptor

    Kostya the Sculptor 题目链接:http://codeforces.com/problemset/problem/733/D 贪心 以次小边为第一关键字,最大边为第二关键字,最小边为 ...

  5. CF733D Kostya the Sculptor[贪心 排序]

    D. Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input stand ...

  6. Codeforces378 D Kostya the Sculptor(贪心)(逻辑)

    Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input standard ...

  7. 【25.47%】【codeforces 733D】Kostya the Sculptor

    time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...

  8. Codeforces Round #378 (Div. 2) D. Kostya the Sculptor 分组 + 贪心

    http://codeforces.com/contest/733/problem/D 给定n个长方体,然后每个长方体都能选择任何一个面,去和其他长方体接在一起,也可以自己一个,要求使得新的长方体的最 ...

  9. [CF733D]Kostya the Sculptor(贪心)

    题目链接:http://codeforces.com/contest/733/problem/D 题意:给n个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少 ...

随机推荐

  1. ES6 利用集合Set解决数组 交集 并集 差集的问题

    根据阮一峰老师的ES6教程自己体会而写的,希望能给一些朋友有帮助到 let a = new Set([1,2,3,4]) let b = new Set([2,3,4,5,]) 并集 let unio ...

  2. python socket和简单tcp通信实现

    python 服务端和客户端的简单交互 TCP服务端: 1 创建套接字,绑定套接字到本地IP与端口 s = socket.socket(socket.AF_INET,socket.SOCK_STREA ...

  3. c# 自定义排序Compare

    .net FrameWork 框架博大精深,用着忘着,计划对自己能够想到知识点梳理一下,此篇是对自定义排序的理解: class Program { static void Main(string[] ...

  4. 诱惑当前 你的孩子能hold住吗?

    1.打好态度.动机.价值观基础 培养未成熟主体远大的志向,并不是向他们讲一些抽象的道理,而是根据他们的年龄特点,从形象的故事.童话开始,从身边的人物.事例出发,逐渐渗透一些人生的哲理.有一位自觉性非常 ...

  5. 解决配置JAVA_HOME JDK版本不变的问题

    解决方案:修改环境变量Path 因为PATH环境变量中默认将system32等系统重要目录添加在最前面,所以运行java -version时当然是调用system32目录下的java.exe了. 所以 ...

  6. JS语句循环(100以内奇偶数、100以内与7先关的数、100以内整数的和、10以内阶乘、乘法口诀、篮球弹起高度、64格子放东西)

    3.循环 循环是操作某一个功能(执行某段代码). ①循环四要素: a 循环初始值 b 循环的条件 c 循环状态 d 循环体 ②for循环 a 穷举:把所有的可能性的都一一列出来. b 迭代:每次循环都 ...

  7. SQL Server Delete Duplicate Rows

    There can be two types of duplication of rows in a table 1. Entire row getting duplicated because th ...

  8. python进行机器学习(三)之模型选择与构建

    Scikit-Learn库已经实现了所有基本机器学习的算法,可以直接调用里面库进行模型构建. 一.逻辑回归 大多数情况下被用来解决分类问题(二元分类),但多类的分类(所谓的一对多方法)也适用.这个算法 ...

  9. dev_cpu_dead

    Kernel: 4.12.6 每个cpu都有自己的softnet_data结构,用来处理数据包接收,但是当softnet_data所在cpu无法工作时,即CPUHP_NET_DEV_DEAD状态,就需 ...

  10. c++设计模式系列----factory模式

    问题: 假设我们要开发一个游戏--打怪物,首先,游戏有分等级,假设有初级,中级两个个等级(就不用flappy bird模式了,那个比较特殊,对一个玩家来说是难以具有持久吸引力的!),不同的等级怪物也是 ...