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. 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 w…
排序.把每一个长方体拆成$6$个做,然后排序做即可. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<set> #inc…
Kostya the Sculptor 这次cf打的又是心累啊,果然我太菜,真的该认真学习,不要随便的浪费时间啦 [题目链接]Kostya the Sculptor &题意: 给你n个长方体,你要使长方体的内切球有体积最大,有两种选择方案 ①只选1个长方体. ②选2个长方体,黏到一起,但这2个长方体黏的那一面必须完全相等.也就是长宽相等. &题解: 1个长方体遍历一遍取最小就好了. 2个的时候要第2短的和第3短的相等,才能合到一起,最小的有可能是2个最小的相加,或者是第2短的那个. 这题比…
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 frien…
Kostya the Sculptor 题目链接:http://codeforces.com/problemset/problem/733/D 贪心 以次小边为第一关键字,最大边为第二关键字,最小边为第三关键字排序,每次只需要找次小边和最大边均相同,最小边最大的两项即可. 因为用Python遇到很多问题,切片操作a[i:j]是左闭右开区间[i,j) 代码如下: n = int(input()) a = [] ans,u,v = 0,-1,-1 for i in range(n): t = [in…
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 frien…
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 Z…
time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard 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 care…
http://codeforces.com/contest/733/problem/D 给定n个长方体,然后每个长方体都能选择任何一个面,去和其他长方体接在一起,也可以自己一个,要求使得新的长方体的最短的那条边最大. 看样例2就知道,因为10.8.7和10.8.2组合后,min =  8,是最大的. 那么怎么做呢? 可以看到,一个长方体,能产生6种不同的摆放方式,然后排序后,排序的时候把a相同的尽可能排在一起,把b相同的尽可能地排在一起.因为这样就能分组了. 把数组分成若干组,相同的组里,a和b…
题目链接:http://codeforces.com/contest/733/problem/D 题意:给n个长方体,允许最多两个拼在一起,拼接的面必须长宽相等.问想获得最大的内切圆的长方体序号是多少.最多拼2个,可以不拼. 最大内切圆与最短的边有关系,在读入的时候做只取一个的情况,接下来按照边长从大到小排序,之后按照最大边依次排序,取相邻的两个拼接在一起看看是否更大. #include <bits/stdc++.h> using namespace std; typedef struct S…
明白了自己这么菜的原因多半是赛后不肯去补那些需要多花点时间思考的题目以及效率不高,但愿现在还不算晚... #include<bits/stdc++.h> #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<string.h> #define maxint 999999999 #d…
对于n==100.1,1,2或者1,2,2大量重复的形状相同的数据,cmp函数最后一项如果表达式带等于,整个程序就会崩溃 还没有仔细分析std::sort的调用过程,所以这里不是很懂..,mark以后研究 因为题目让你挑一到两个平行六面体,然后去每个平行六面体长宽高的最小值,然后去求最小值中的最大值 我们很容易想到暴力的做法,如果两个平行六面体能够合并的话,那我们直接计算合并之后的最小值,因为我们知道此时 合并之后再求最小值,它是只增不减的 那么我们就要找到能合并某一个面的所有平行六面体的集合,…
这题本来  想二分.想了很久很久,解决不了排序和二分的冲突.     用贪心吧.. 题意: 给你n个长方形,让你找出2个或1个长方体,使得他们拼接成的长方体的内接球半径最大(这是要求最短边越大越好)(两个矩形拼接的条件是 他们有一个面完全相同) 输入n,输入第 i个长方体的 三条边长度.最多2个长方体拼接. 输出  不要拼接的"1"和最大能切成内切球的 i  :或者输出要拼接的“2”和这两个长方体的序号 i . 如果 两个长方体的边长分别是 3 2 4,3 2 4  .可以拼接成  6…
A. Grasshopper And the String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper became i…
A题 A. Grasshopper And the String time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output One day, the Grasshopper was jumping on the lawn and found a piece of paper with a string. Grasshopper becam…
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 frien…
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 frien…
http://codeforces.com/problemset/problem/666/B 题意: 给定一张边权均为1的有向图,求四个不同的点A,B,C,D,使得dis[A][B]+dis[B][C]+dis[C][D]尽可能大.   预处理能到B的前3远,C能到的前3远 枚举B.C     #include<iostream> #include<cstring> #include<cstdio> #include<queue> using namespa…
B. Code obfuscation 题目连接: http://codeforces.com/contest/765/problem/B Description Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally…
C. Captains Mode 题目连接: http://codeforces.com/contest/377/problem/C Description Kostya is a progamer specializing in the discipline of Dota 2. Valve Corporation, the developer of this game, has recently released a new patch which turned the balance of…
B. World Tour 题目连接: http://www.codeforces.com/contest/666/problem/B Description A famous sculptor Cicasso goes to a world tour! Well, it is not actually a world-wide. But not everyone should have the opportunity to see works of sculptor, shouldn't he…
A. Neverending competitions time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output There are literally dozens of snooker competitions held each year, and team Jinotega tries to attend them all (f…
地址:http://codeforces.com/contest/765/problem/B 题目: B. Code obfuscation time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Kostya likes Codeforces contests very much. However, he is very disap…
Description Kostya likes Codeforces contests very much. However, he is very disappointed that his solutions are frequently hacked. That's why he decided to obfuscate (intentionally make less readable) his code before upcoming contest. To obfuscate th…
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Nothing is eternal in the world, Kostya understood it on the 7-th of January when he saw partially dead four-color garland. Now he has a goal to…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…