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个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少 ...
随机推荐
- iOS Button设置
UIButton *kefuBtn = [[UIButton alloc]initWithFrame:CGRectMake(, , , )]; kefuBtn.backgroundColor = SX ...
- Tomcat启动报错:org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalin
Error starting ApplicationContext. To display the auto-configuration report re-run your application ...
- 【bzoj1572-工作安排】贪心
题目:http://www.lydsy.com/JudgeOnline/problem.php?id=1572 题意: 约翰接到了N份工作,每份工作恰好占用一天的时间.约翰从第一天开始工作,他可以任意 ...
- bzoj 1914: [Usaco2010 OPen]Triangle Counting 数三角形——极角排序
Description 在一只大灰狼偷偷潜入Farmer Don的牛群被群牛发现后,贝西现在不得不履行着她站岗的职责.从她的守卫塔向下瞭望简直就是一件烦透了的事情.她决定做一些开发智力的小练习,防止她 ...
- 【BZOJ】1774: [Usaco2009 Dec]Toll 过路费
[题意]给定无向图,距离定义为边权和+最大点权,询问若干个两点最短距离.n<=250. [算法]排序+floyd [题解]考虑floyd的过程是每次找一个中转点,为了在当前找到一条新路径时方便地 ...
- I题 hdu 1234 开门人和关门人
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1234 开门人和关门人 Time Limit: 2000/1000 MS (Java/Others) ...
- Java线程总结(二)
自定义线程的数据可以共享,也可以不共享,这要看具体的实现方式. 1.不共享数据多线程实现方式: public class MyThread extends Thread{ private int co ...
- Linux网络编程之套接字基础
1.套接字的基本结构 struct sockaddr 这个结构用来存储套接字地址. 数据定义: struct sockaddr { unsigned short sa_family; /* addre ...
- 需要重刷整個 image 的時機 - 1
最近遇到一個問題, gpio 讀出來的值與預期不同, 詳細描述如下: 首先手機 download 了一個完整的 daily build image , 接下來 不斷地修改 kernel 部分 code ...
- centos_7.1.1503_src_2
farstream02-0.2.3-3.el7.src.rpm 05-Jul-2014 12:59 1.2M fcoe-utils-1.0.29-9.el7.src.rpm 31-Mar-2015 ...