D. Kostya the Sculptor
time limit per test

3 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Kostya is a genial sculptor, he has an idea: to carve a marble sculpture in the shape of a sphere. Kostya has a friend Zahar who works at a career. Zahar knows about Kostya's idea and wants to present him a rectangular parallelepiped of marble from which he can carve the sphere.

Zahar has n stones which are rectangular parallelepipeds. The edges sizes of the i-th of them are aibi and ci. He can take no more than two stones and present them to Kostya.

If Zahar takes two stones, he should glue them together on one of the faces in order to get a new piece of rectangular parallelepiped of marble. Thus, it is possible to glue a pair of stones together if and only if two faces on which they are glued together match as rectangles. In such gluing it is allowed to rotate and flip the stones in any way.

Help Zahar choose such a present so that Kostya can carve a sphere of the maximum possible volume and present it to Zahar.

Input

The first line contains the integer n (1 ≤ n ≤ 105).

n lines follow, in the i-th of which there are three integers ai, bi and ci (1 ≤ ai, bi, ci ≤ 109) — the lengths of edges of the i-th stone. Note, that two stones may have exactly the same sizes, but they still will be considered two different stones.

Output

In the first line print k (1 ≤ k ≤ 2) the number of stones which Zahar has chosen. In the second line print k distinct integers from 1 to n — the numbers of stones which Zahar needs to choose. Consider that stones are numbered from 1 to n in the order as they are given in the input data.

You can print the stones in arbitrary order. If there are several answers print any of them.

Examples
input
6
5 5 5
3 2 4
1 4 1
2 1 3
3 2 4
3 3 4
output
1
1
input
7
10 7 8
5 10 3
4 2 6
5 5 5
10 2 8
4 2 1
7 7 7
output
2
1 5
Note

In the first example we can connect the pairs of stones:

  • 2 and 4, the size of the parallelepiped: 3 × 2 × 5, the radius of the inscribed sphere 1
  • 2 and 5, the size of the parallelepiped: 3 × 2 × 8 or 6 × 2 × 4 or 3 × 4 × 4, the radius of the inscribed sphere 1, or 1, or 1.5respectively.
  • 2 and 6, the size of the parallelepiped: 3 × 5 × 4, the radius of the inscribed sphere 1.5
  • 4 and 5, the size of the parallelepiped: 3 × 2 × 5, the radius of the inscribed sphere 1
  • 5 and 6, the size of the parallelepiped: 3 × 4 × 5, the radius of the inscribed sphere 1.5

Or take only one stone:

  • 1 the size of the parallelepiped: 5 × 5 × 5, the radius of the inscribed sphere 2.5
  • 2 the size of the parallelepiped: 3 × 2 × 4, the radius of the inscribed sphere 1
  • 3 the size of the parallelepiped: 1 × 4 × 1, the radius of the inscribed sphere 0.5
  • 4 the size of the parallelepiped: 2 × 1 × 3, the radius of the inscribed sphere 0.5
  • 5 the size of the parallelepiped: 3 × 2 × 4, the radius of the inscribed sphere 1
  • 6 the size of the parallelepiped: 3 × 3 × 4, the radius of the inscribed sphere 1.5

It is most profitable to take only the first stone.


题意:一堆矩形平行六面体(雾

一堆长方体,可以选一个也可以选两个粘起来,求最大的球选哪个


最近数学正好在学立体几何................

园半径是min(a,b,c)/2,让最小边最大就好了

两个粘起来,一定是把最短边粘起来了,否则没有影响啊

所以每个长方体x最长边y次长边z最短边,然后按x,y,z优先级排序,看看相邻两个能不能粘起来行了

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N=1e5+,INF=1e9+;
inline int read(){
char c=getchar();int x=,f=;
while(c<''||c>''){if(c=='-')f=-;c=getchar();}
while(c>=''&&c<=''){x=x*+c-'';c=getchar();}
return x*f;
} int n,t[],ans1,p1,ans2,p2;
struct rec{
int id,x,y,z;
bool operator <(const rec &r)const{
if(x==r.x){
if(y==r.y) return z>r.z;
else return y>r.y;
}else return x>r.x;
}
}a[N];
int main(){
n=read();
for(int i=;i<=n;i++){
t[]=read();t[]=read();t[]=read();
sort(t+,t+);
a[i].x=t[],a[i].y=t[],a[i].z=t[]; a[i].id=i;
if(a[i].z>ans1) ans1=a[i].z,p1=i;
} sort(a+,a++n);
for(int i=;i<=n;i++){
if(a[i].x==a[i+].x&&a[i].y==a[i+].y){
int t=min(a[i].y,a[i].z+a[i+].z);
if(t>ans2) ans2=t,p2=i;
}
}
if(ans1>ans2) printf("1\n%d",p1);
else printf("2\n%d %d",a[p2].id,a[p2+].id);
}

CF733D Kostya the Sculptor[贪心 排序]的更多相关文章

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

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

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

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

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

  4. Kostya the Sculptor

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

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

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

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

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

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

  8. Kostya the Sculptor(贪心

    这题本来  想二分.想了很久很久,解决不了排序和二分的冲突.     用贪心吧.. 题意: 给你n个长方形,让你找出2个或1个长方体,使得他们拼接成的长方体的内接球半径最大(这是要求最短边越大越好)( ...

  9. codeforces733D. Kostya the Sculptor 偏序cmp排序,数据结构hash,代码简化

    对于n==100.1,1,2或者1,2,2大量重复的形状相同的数据,cmp函数最后一项如果表达式带等于,整个程序就会崩溃 还没有仔细分析std::sort的调用过程,所以这里不是很懂..,mark以后 ...

随机推荐

  1. 疯狂Android讲义 - 学习笔记(六)

    第7章 7.1 使用简单图片 7.1.1 使用Drawable对象 7.1.2 Bitmap和BitmapFactory 7.2 绘图 7.2.1 Android绘图基础:Canvas.Paint等 ...

  2. 【工业串口和网络软件通讯平台(SuperIO)教程】五.二次开发图形显示界面

    SuperIO相关资料下载:http://pan.baidu.com/s/1pJ7lZWf 1.1    图形显示接口的作用 用于显示采集终端设备的数据,可以把不同类型设备的数据以多种形式集成显示在不 ...

  3. Elasticsearch初步使用(安装、Head配置、分词器配置)

    目录 返回目录:http://www.cnblogs.com/hanyinglong/p/5464604.html 1.ElasticSearch简单说明 a.ElasticSearch是一个基于Lu ...

  4. 如何使用jQuery 制作全屏幕背景的嵌入视频

    实际效果查看:http://keleyi.com/keleyi/phtml/jqtexiao/28.htm 请使用支持HTML5的浏览器查看本效果. 完整代码如下: <!doctype html ...

  5. Bootstrap组件之响应式导航条

    响应式导航条:在PC和平板中默认要显示所有的内容:但在手机中导航条中默认只显示“LOGO/Brand”,以及一个“菜单折叠展开按钮”,只有单击折叠按钮后才显示所有的菜单项. 基础class: .nav ...

  6. Atitit.常见软件 数据 交换格式 标准

    Atitit.常见软件 数据 交换格式 标准 1. 常见的数据格式txt ,doc ,pic,music ,vodio1 2. 通用格式json yaml phpstr1 3. 专用格式1 4. 用户 ...

  7. SharePoint 2013 Search 配置总结

    前言:SharePoint 2013集成了Fast搜索以后,搜索的配置有了些许改变,自己在配置过程中,也记录下了一些入门的东西,希望能够对大家有所帮助. 1.配置搜索服务,首先需要启用搜索功能,基本思 ...

  8. Sharepoint学习笔记—习题系列--70-576习题解析 -(Q138-Q140)

    Question  138 You are designing a SharePoint 2010 application that will deploy a Web Part assembly. ...

  9. Attempt to insert non-property list object 报错原因

    NSUserDefault 支持的存储类型有:NSString. NSNumber.NSDate. NSArray.NSDictionary.BOOL.NSInteger.NSFloat等系统定义的数 ...

  10. iOS字体