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的更多相关文章

  1. 湖南大学第十四届ACM程序设计新生杯(重现赛)G a+b+c+d=? (16进制与LL范围)

    链接:https://ac.nowcoder.com/acm/contest/338/G来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 32768K,其他语言65536K6 ...

  2. 湖南大学第十四届ACM程序设计新生杯(重现赛)I:II play with GG(博弈论||DP)

    链接:https://ac.nowcoder.com/acm/contest/338/I 来源:牛客网 题目描述 IG won the S championship and many people a ...

  3. 湖南大学第十四届ACM程序设计新生杯(重现赛)

    RANK  0 题数 0 期末复习没有参加,补几道喜欢的题. A: AFei Loves Magic  签到 思路 :不需考虑 碰撞 直接计算最终状态即可. #include<bits/stdc ...

  4. 湖南大学第十四届ACM程序设计新生杯 E.Easy Problem

    E.Easy Problem Description: Zghh likes number, but he doesn't like writing problem description. So h ...

  5. 福建工程学院第十四届ACM程序设计大赛 - E - 外传:小晋逃生记

    http://www.fjutacm.com/Contest.jsp?cid=705#P4 其实想清楚了就很简单,之前想了很多种方法,以为是二分什么的,看起来就像是一个单峰函数.但是发现直接暴力一波就 ...

  6. 福建工程学院第十四届ACM校赛M题题解 fwt进阶,手推三进制fwt

    第九集,结束亦是开始 题意: 大致意思就是给你n个3进制的数字,让你计算有多少对数字的哈夫曼距离等于i(0<=i<=2^m) 思路: 这个是一个防ak题,做法是要手推公式的fwt 大概就这 ...

  7. 湖南大学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 ...

  8. 湖南大学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 ...

  9. 湖南大学ACM程序设计新生杯大赛(同步赛)L - Liao Han

    题目描述 Small koala special love LiaoHan (of course is very handsome boys), one day she saw N (N<1e1 ...

随机推荐

  1. Python学习笔记:第2天while循环 运算符 格式化输出 编码

    目录 1. while循环 continue.break和else语句 2. 格式化输出 3. 运算符 3.1 算数运算 3.2 比较运算符 3.3 赋值运算符 3.4 逻辑运算符 3.5 成员运算符 ...

  2. python更新mysql数据

    >>>cur.execute("update users set username=%s where id=2",("mypython")) ...

  3. ABAP CDS - Syntax

    The syntax of the DDL and of the DCL of the ABAP CDS comprises elements of the general DDL and DCL o ...

  4. C#基础--之数据类型【转】

    在第一章我们了解了C#的输入.输出语句后,我这一节主要是介绍C#的基础知识,本节的内容也是后续章节的基础,好的开端等于成功的一半.在你阅读完本章后,你就有足够的C#知识编写简单的程序了.但还不能使用继 ...

  5. 【python3.X】python练习笔记[1]

    ##三位数水仙花 ##方法一,小于指定数字的水仙花数 x=eval(input()) a,b,c = 0,0,0 for i in range (100,x,1): a=i%10 b=i//100 c ...

  6. 《.NET 微服务:适用于容器化 .NET 应用的体系结构》关键结论

    作为总结和要点,以下是本指南中最重要的结论.1 使用容器的好处: 基于容器的解决方案有节约成本的好处,因为容器是针对生产环境中缺少依赖而导致的部署问题提出的解决方案.容器能够显著改善devops和生产 ...

  7. Android各版本代号、版本号、API/NDK级别、发布时间

    代号 版本号 API/NDK级别 发布时间 牛轧糖 Nougat 7.1.2 API level 25 2017-2 7.1.1 2016-10 7.0 API level 24 2016-05 棉花 ...

  8. Kindle 3(非常旧的版本) 隔一段时间自动重启问题

    买了本新书后,kindle 3 自己没事就在那边重启,几分钟一次 查到解决方案1: https://answers.yahoo.com/question/index?qid=2014040815565 ...

  9. Hessian 2.0 序列化协议 - Hessian 2.0 Serialization Protocol 翻译

    Hessian是一种轻量.快速的web协议,在微服务场景下经常被使用. Hessian协议实际上包含两种含义: 1. Web网络通信远程调用服务,具体可以参考:http://hessian.cauch ...

  10. HDU 4010 Query on The Trees(动态树LCT)

    Problem Description We have met so many problems on the tree, so today we will have a query problem ...