Codeforces 733D Kostya the Sculptor 贪心
来源:互联网 发布:淘宝怎么进入投诉 编辑:程序博客网 时间:2024/06/05 16:16
点击打开链接
给出a,b,c三边,可以rotate 长宽高可以互换
平行六面体内接球半径由六面体最短的那条边决定 所以最短边越大好,排好序:按较大两边相同 合并第三边后,取最短边后更新即可
#include <iostream>#include <algorithm>#include <list>#include <cstdio>#include <cstdlib>#include <cstring>#include <queue>#include <map>#include <vector>using namespace std;typedef long long ll;const ll mod=1e9+7;const int N= 1e6+20;struct Node{int a,b,c;//边长从大到小 int id;bool operator<(const Node &t)const{if(a!=t.a) return a<t.a;if(b!=t.b) return b<t.b;return c<t.c;}}node[N]; int main(){int n;cin>>n;int ans=0,id1,id2;//取一件和两件的最大半径的编号//平行六面体的最短边越大,内接球的半径也就越大 for(int i=0;i<n;i++){int a,b,c;cin>>a>>b>>c;//可以rotate if(c>b)swap(b,c);if(c>a)swap(a,c);if(a<b)swap(a,b);if(ans<c){ans=c;id1=i+1;}node[i].a=a;node[i].b=b;node[i].c=c;node[i].id=i+1;}sort(node,node+n);int i=0,r; while(i<n){r=i;while(r<n&&node[r].a==node[i].a&&node[r].b==node[i].b)r++;r--;//相同的两个面合并,使最短边尽可能的大,最最大的两个c合并 if(r==i){i=r+1;continue;}int res=node[r].b;res=min(res,node[r].c+node[r-1].c);if(ans<res){ans=res;id1=-1;id2=r;//}i=r+1;// }if(id1>0){cout<<1<<endl<<id1<<endl;}elsecout<<2<<endl<<node[id2-1].id<<" "<<node[id2].id<<endl;return 0;}
0 0
- 【Codeforces 733D】 Kostya the Sculptor【贪心】
- Codeforces 733D Kostya the Sculptor 贪心
- 733D Kostya the Sculptor codeforces (贪心)
- 【25.47%】【codeforces 733D】Kostya the Sculptor
- codeforces 733D Kostya the Sculptor
- Codeforces 733D Kostya the Sculptor
- CodeForces 733D Kostya the Sculptor
- codeforces 733D. Kostya the Sculptor
- CodeForces 733D - Kostya the Sculptor
- Codeforces 733D Kostya the Sculptor
- Codeforces Round #378 (Div. 2) D. Kostya the Sculptor【贪心】
- 733D Kostya the Sculptor
- Codeforces 733D D. Kostya the Sculptor By Assassin
- CodeForces 733D Kostya the Sculptor 思维题
- CodeForces - 733D Kostya the Sculptor (STL SET)
- CodeForces 733 D.Kostya the Sculptor(水~)
- Kostya the Sculptor CodeForces
- Codeforces Round #378 (Div. 2)-D. Kostya the Sculptor(multiset)
- Javascript 关键字(keywords)、保留字(reservedwords)
- Python 基础语法
- ubuntu 下 如何将 doc 转 txt
- Android SDK上手指南:项目清单
- 关于Android 6.0+ Dangerous Permissions (运行时权限,敏感权限) 《实用篇》
- Codeforces 733D Kostya the Sculptor 贪心
- JAVA的StringBuffer类
- MySQL性能优化的21条最佳经验
- 交大博士血泪自述:不是读博的料,别上博士这条船
- Android SDK上手指南:应用程序数据
- try catch 不到异常的处理
- POJ Problem 1664 放苹果
- SQL触发器实例学习
- CodeForces 731A Night at the Museum