2017 Wuhan University Programming Contest 现场赛G. Room(set+思路)
来源:互联网 发布:数据库软件工程师考试 编辑:程序博客网 时间:2024/06/06 00:02
问题 G: Room
时间限制: 1 Sec 内存限制: 64 MB提交: 11 解决: 8
[提交][状态][讨论版]
题目描述
The ACM / ICPC team has a large room, the length and width of which is 10^6 . However, the guys in ACM / ICPC teams are too lazy to make their study room tidy. So there are wires everywhere and divide the room into several parts. A team in a part of the room cannot move out of it or they might touch the wires and the network will down. To make every team can compete in the contest, they have to set up some facilities such as toilet since the teams should do anything in their parts. Now, we will give you the map of our study room and the position of the teams, your task is to calculate how many facilities is required to let every team can access a facilities to finish the contest without move out of their part. You should note that two or more teams can share a facility.
输入
输出
Output one integer, the minimal facilities required.
样例输入
30 200000 1000000 600000600000 0 300000 10000000 800000 1000000 4000009200000 900000200000 400000300000 600000600000 500000700000 700000800000 300000300000 200000800000 100000600000 200000
样例输出
6
提示
#include <iostream>#include <cstdio>#include <cstring>#include<string.h>#include <algorithm>#include<set>#define ll long long#define wtf printf("wtf");using namespace std;struct node{ int x1,y1,x2,y2;}e[100005];struct xx{ int x,y;}p[105];set<string>s;ll check(node a,xx b){ ll A=a.y2-a.y1; ll B=a.x1-a.x2; ll C=(-B*a.y1-A*a.x1); return A*b.x+B*b.y+C>0;}ll solve(ll n,ll t){ for(ll i=1;i<=t;i++) { string str=""; for(ll j=1;j<=n;j++) str+=check(e[j],p[i])+'0'; s.insert(str); } return s.size();}int main(){ ll n,t; cin>>n; for(ll i=1;i<=n;i++) scanf("%lld%lld%lld%lld",&e[i].x1,&e[i].y1,&e[i].x2,&e[i].y2); cin>>t; for(ll i=1;i<=t;i++) scanf("%lld%lld",&p[i].x,&p[i].y); printf("%lld\n",solve(n,t)); return 0;}
0 0
- 2017 Wuhan University Programming Contest 现场赛G. Room(set+思路)
- 2017 Wuhan University Programming Contest 现场赛G. Room
- 2017 Wuhan University Programming Contest 现场赛I: A simple math problem(矩阵快速幂)
- 2017 Wuhan University Programming Contest 现场赛 K.Wifi Relay(最短路变形)
- 2017 Wuhan University Programming Contest 现场赛 I.A simple math problem(矩阵快速幂)
- 2017 Wuhan University Programming Contest 现场赛 K.Wifi Relay(dijkstra)
- 2017 Wuhan University Programming Contest (Online Round)(补题补题)
- 2017 Wuhan University Programming Contest 题解
- 2017 Wuhan University Programming Contest --Lost in WHU
- 2017 Wuhan University Programming Contest (Online Round) E. Lost in WHU(矩阵快速幂)
- 2017 Wuhan University Programming Contest (Online Round) E. Lost in WHU(矩阵快速幂)
- WHU B Color 2017 Wuhan University Programming Contest 一道简单树形dp
- 2017 Wuhan University Programming Contest (Online Round) D. Events,线段树区间更新+最值查询!
- Color(树形dp)——2017 Wuhan University Programming Contest (Online Round)
- 2017 Wuhan University Programming Contest (Online Round) ELost in WHU(矩阵快速幂
- 2017 Wuhan University Programming Contest (Online Round) A One car comes and one car goes
- The 11th Zhejiang University Programming Contest - G/ Gaussian Prime
- The 11th Zhejiang University Programming Contest C G J
- javaScript数据类型
- vuejs2和echarts3组合显示图表
- SRM573 Div1Medium Ski Resorts
- 二分查找
- Android图片加载框架最全解析(四),玩转Glide的回调与监听
- 2017 Wuhan University Programming Contest 现场赛G. Room(set+思路)
- AS中jar包冲突解决方案
- Unity3d学习 基础-关于MonoBehaviour的生命周期
- 递归算法遍历文件夹中所有文件
- Tomcat配置理解
- Xamarin android沉浸式状态栏
- 策略模式(Strategy Pattern)
- 二叉树的前序遍历
- 最大网络流