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个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少 ...
随机推荐
- MSSQL,MySQL 语法区别
1 mysql支持enum,和set类型,sql server不支持 2 mysql不支持nchar,nvarchar,ntext类型 3 mysql的递增语句是AUTO_INCREMENT,而mss ...
- [LeetCode] 15. 3Sum ☆☆
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all un ...
- 图论:Prufer编码
BZOJ1211:使用prufer编码解决限定结点度数的树的计数问题 首先学习一下prufer编码是干什么用的 prufer编码可以与无根树形成一一对应的关系 一种无根树就对应了一种prufer编码 ...
- vijos 1907 DP+滚动数组
描述 Flappy Bird 是一款风靡一时的休闲手机游戏.玩家需要不断控制点击手机屏幕的频率来调节小鸟的飞行高度,让小鸟顺利通过画面右方的管道缝隙.如果小鸟一不小心撞到了水管或者掉在地上的话,便宣告 ...
- 「6月雅礼集训 2017 Day10」quote
[题目大意] 一个合法的引号序列是空串:如果引号序列合法,那么在两边加上同一个引号也合法:或是把两个合法的引号序列拼起来也是合法的. 求长度为$n$,字符集大小为$k$的合法引号序列的个数.多组数据. ...
- 【Luogu】P3933 Chtholly Nota Seniorious
[题意]将n*m矩阵分成两个区域,要求满足一定条件,求两区域内部极差较大值最小.n,m<=2000 [算法]二分 [题解]极差的数值满足单调性,所以考虑二分极差. 对于给定的极差,将所有数值排序 ...
- PHP 练习1:新闻发布
1.新闻发布主页面 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w ...
- [Unity]模拟雨水的折射效果
用GrabPass做的小玩具. 并不是真的计算了折射,只是简单地扰动了uv,对于雨水来说效果已经足够好了. Shader代码: Shader "Unlit/Rain" { Prop ...
- niceScroll 简单使用 及 插件API
官方网址[https://nicescroll.areaaperta.com/] 注:效果见官网右侧滚动条 jquery.nicescroll文件下载地址 引入核心文件,插件需要引入1.5.X以上版 ...
- python中range函数与列表中删除元素
一.range函数使用 range(1,5) 代表从1到4(不包含5),结果为:1,2,3,4 ,默认步长为1 range(1,5,2) 结果为:1, 3 (同样不包含5) ,步长为2 ...