湖南大学第十四届ACM程序设计新生杯 Dandan's lunch
Dandan's lunch
Description:
As everyone knows, there are now n people participating in the competition. It was finally lunch time after 3 hours of the competition. Everyone brought a triangular bread. When they were going to eat bread, some people found that they solved more problems than others, but their bread was smaller than others. They thought it was very unfair. In this case, they will forcibly exchange bread with the other party (may be exchanged many times, someone can still exchange with others after being exchanged if the above conditions are satisfied, the other party can not refuse).
    The description of the bread is given by the coordinates of the three vertices of the triangle. The size of the bread is twice the size of the triangle area, ensuring that there are no two breads of the same size, and the number of problems each person makes is different.
    Dandan is also one of the contestants. Now he knows the number of problems solved by each person and the description of the bread they bring. Now he wants to know that after all the exchanges are over (That is, there can be no more exchanges between any two people), The size of the bread he can get.
Input:
The first line gives an integer n, which indicates the number of people who participated in the competition.
Lines 2~n+1, each line gives 7 integers separated by spaces such as:
num x1 y1 x2 y2 x3 y3
num represents the number of the ith personal problem solving. (x1, y1) (x2, y2) (x3, y3) represents the coordinates of the three points of the bread of the triangle with the i-th person. ensure that three points are not in the same line.
Notice that the second line (the first person) represents Dandan's information.
Data guarantee: 0<n<=1e5,0<=num<1e9, -1e8<x1, x2, x3, y1, y2, y3<1e8.
Output:
Outputs an integer representing the size of the bread that DanDan eventually gets.
Sample Input:
1
100000000 0 0 10000 0 0 1000
Sample Output:
10000000
题意:
给出n个三角形的三个顶点坐标,求第x大的三角形面积的2倍是多少。(详见Description)
题解:
就是叉乘求平行四边形面积,注意下绝对值。后面排个序找一下就好了。
代码如下:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <queue>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 1e5+;
int n;
int a[N];
int main(){
cin>>n;
vector <ll> vec;
for(int i=;i<=n;i++){
scanf("%d",&a[i]);
int x1,x2,x3,y1,y2,y3;
scanf("%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3);
ll vecx1 = x2-x1,vecx2 = x3-x1;
ll vecy1 = y2-y1,vecy2 = y3-y1;
vec.push_back(vecx1*vecy2-vecy1*vecx2);
}
sort(vec.begin(),vec.end());
int tmp=a[];
sort(a+,a+n+);
for(int i=;i<=n;i++){
if(a[i]==tmp){
cout<<vec[i-];
return ;
}
}
return ;
}
湖南大学第十四届ACM程序设计新生杯 Dandan's lunch的更多相关文章
- 湖南大学第十四届ACM程序设计新生杯(重现赛)G a+b+c+d=? (16进制与LL范围)
		
链接:https://ac.nowcoder.com/acm/contest/338/G来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K6 ...
 - 湖南大学第十四届ACM程序设计新生杯(重现赛)I:II play with GG(博弈论||DP)
		
链接:https://ac.nowcoder.com/acm/contest/338/I 来源:牛客网 题目描述 IG won the S championship and many people a ...
 - 湖南大学第十四届ACM程序设计新生杯(重现赛)
		
RANK 0 题数 0 期末复习没有参加,补几道喜欢的题. A: AFei Loves Magic 签到 思路 :不需考虑 碰撞 直接计算最终状态即可. #include<bits/stdc ...
 - 湖南大学第十四届ACM程序设计新生杯 E.Easy Problem
		
E.Easy Problem Description: Zghh likes number, but he doesn't like writing problem description. So h ...
 - 福建工程学院第十四届ACM程序设计大赛 - E - 外传:小晋逃生记
		
http://www.fjutacm.com/Contest.jsp?cid=705#P4 其实想清楚了就很简单,之前想了很多种方法,以为是二分什么的,看起来就像是一个单峰函数.但是发现直接暴力一波就 ...
 - 福建工程学院第十四届ACM校赛M题题解 fwt进阶,手推三进制fwt
		
第九集,结束亦是开始 题意: 大致意思就是给你n个3进制的数字,让你计算有多少对数字的哈夫曼距离等于i(0<=i<=2^m) 思路: 这个是一个防ak题,做法是要手推公式的fwt 大概就这 ...
 - 湖南大学ACM程序设计新生杯大赛(同步赛)J - Piglet treasure hunt Series 2
		
题目描述 Once there was a pig, which was very fond of treasure hunting. One day, when it woke up, it fou ...
 - 湖南大学ACM程序设计新生杯大赛(同步赛)A - Array
		
题目描述 Given an array A with length n a[1],a[2],...,a[n] where a[i] (1<=i<=n) is positive integ ...
 - 湖南大学ACM程序设计新生杯大赛(同步赛)L - Liao Han
		
题目描述 Small koala special love LiaoHan (of course is very handsome boys), one day she saw N (N<1e1 ...
 
随机推荐
- RHEL-7.1 Server.x86_64 yum源设置为光盘
			
1.挂载光盘 首先在media目录下创建文件夹CentOS mkdir CentOS 然后将光盘挂载在CentOS下 mount -t iso9660 -o loop /dev/cdrom /medi ...
 - oracle 数据被修改怎么修复?(闪回)
			
数据被删除 或者 update 的时候忘记勾选where 限制条件,数据全部更新了? 怎么办? 要跑路了? NO !!! 看下面,迅速帮你闪回数据! demo sql: 1. SELECT * FR ...
 - Hibernate-ORM:13.Hibernate中的连接查询
			
------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 本篇博客将会解释Hibernate中的连接查询(各种join) 一,目录 1.内链接 1.1显式内连接(inn ...
 - linux命令大全(转载)
			
在搭建openstack时遇到问题,导致上网查询相关信息.找到一篇不错的文章,希望对大家有用.下附地址: http://blog.csdn.net/junbujianwpl/article/detai ...
 - NoSQL简单学习(一)
			
只是简单的知道有这个东西,却从来没有去接触,今天看了几篇文章,记录一下,开始慢慢接触这一领域 简介: 8种Nosql数据库系统对比 http://blog.jobbole.com/1344/ 一网打尽 ...
 - 「暑期训练」「Brute Force」 Restoring Painting (CFR353D2B)
			
题意 给定一定条件,问符合的矩阵有几种. 分析 见了鬼了,这破题谁加的brute force的标签,素质极差.因为范围是1e5,那你平方(枚举算法)的复杂度必然爆. 然后你就会思考其中奥妙无穷的数学规 ...
 - gitbash避免每次push都输入密码
			
gitbash每次提交都要输密码真有点头疼,所以就: 1 创建验证文件:touch .git-credentials(windows) 2 编辑验证文件:vim .git-credentials ...
 - 用Python 的一些用法与 JS 进行类比,看有什么相似?
			
Python 是一门运用很广泛的语言,自动化脚本.爬虫,甚至在深度学习领域也都有 Python 的身影.作为一名前端开发者,也了解 ES6 中的很多特性借鉴自 Python (比如默认参数.解构赋值. ...
 - sphinx调用API参考(官方手册)
			
API的参考实现是用PHP写成的,因为(我们相信)较之其他语言,Sphinx在PHP中应用最广泛.因此这份参考文档基于PHP API的参考,而且这节中的所有的代码样例都用PHP给出. 当然,其他所有A ...
 - 配置cas可外网访问
			
把应用程序tomcat下的conf下的context.xml里配置内容修改 如把: D:\apache-tomcat-APP\conf\context.xml <Resource name=&q ...