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个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少 ...
随机推荐
- Python代码解决RenderView窗口not found问题
源 起 Error:setParent: Object 'renderView' not found 这是一个在工作中很常见的问题,以前做特效的时候有10%的概率会碰到,多发生在打开其他组交接来的Ma ...
- truncate与delete以及drop
truncate:删除整个表,但不删除定义(删除了整个表的数据,但表结构还在) drop:删除整个表,表数据和表结构都删除了 delete:删除表中数据 比较delete和drop 1.truncat ...
- 【Foreign】Game [博弈论][DP]
Game Time Limit: 20 Sec Memory Limit: 512 MB Description 从前有个游戏.游戏分为 k 轮. 给定一个由小写英文字母组成的字符串的集合 S, 在 ...
- bzoj 1774: [Usaco2009 Dec]Toll 过路费 ——(改)floyd
Description 跟所有人一样,农夫约翰以着宁教我负天下牛,休叫天下牛负我的伟大精神,日日夜夜苦思生 财之道.为了发财,他设置了一系列的规章制度,使得任何一只奶牛在农场中的道路行走,都 要向农夫 ...
- 回顾一下MyBatis逆向工程——自动生成代码
前言 最近做的项目(SSM+Shiro)的数据库表已经创建完成,一共有15张表,如果我们一个个去写pojo/bean的代码以及各种sql语句的话未免太过麻烦而且很容易出错,这个时候我们就需要MyBat ...
- Web Session 浅入浅出(山东数漫江湖)
使用过几种Web App开发语言和框架,都会接触到Session的概念.即使是一个简单站点访问计数的功能,也常常使用Session来实现的.其他常用的领域还有购物车,登录用户等.但是,对Session ...
- 【洛谷 P2303】 [SDOi2012]Longge的问题 (欧拉函数)
题目链接 题意:求\(\sum_{i=1}^{n}\gcd(i,n)\) 首先可以肯定,\(\gcd(i,n)|n\). 所以设\(t(x)\)表示\(gcd(i,n)=x\)的\(i\)的个数. 那 ...
- bzoj 3035 二分答案+二分图最大匹配
大原来做的一道题,偷懒直接粘的原来的程序 http://www.cnblogs.com/BLADEVIL/p/3433520.html /******************************* ...
- windows7_常用操作终端操作
查看环境变量:set 添加环境变量:set aa = 88 删除环境变量:set aa = 查看ip配置:ipconfig 查看全局环境变量配置:path 查看当前目录文件:dir 进入E盘:E: 进 ...
- Linux_信号与信号量【转】
转自:http://blog.csdn.net/sty23122555/article/details/51470949 信号: 信号机制是类UNIX系统中的一种重要的进程间通信手段之一.我们经常使用 ...