*感谢两位浙江大佬带我飞

贴下成绩

div2

div1

*div2不是我打的上个厕所就5/11了

比赛小结

A

【题目大意】

有n(n<=500)个机场,两两之间距离是g[i][j],每经停一个机场需要p[i]的时间维修

有m条线路,描述为出发机场,终点机场,出发时间,求航空公司至少需要多少架飞机

每条航线必须直飞

但是转机的时候可以劲停多个机场

【题解】

首先一架飞机能在完成航线A后去飞航线B的条件很显然。就是

表示两点间最短路。那么我们可以用这个不等式把问题转化为最小路径覆盖问题

我想了下这个最短路用Floyd吧n^3我选择死亡时限是5s应该能过的

然后忧虑了一下我的dinic的常数,写了个匈牙利,但是之后有人和我讲dinic更快?

#include<map>
#include<stack>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<complex>
#include<iostream>
#include<assert.h>
#include<algorithm>
using namespace std;
#define inf 1001001001
#define infll 1001001001001001001LL
#define FOR0(i,n) for(int (i)=0;(i)<(n);++(i))
#define ll long long
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl
#define gmax(a,b) (a)=max((a),(b))
#define gmin(a,b) (a)=min((a),(b))
#define ios0 ios_base::sync_with_stdio(0)
#define Ri register int
#define gc getchar()
#define il inline
#define FOR1(i,n) for(Ri (i)=1;(i)<=(n);++(i))
il int read(){
bool f=true;
Ri x=;char ch;
while(!isdigit(ch=gc))if(ch=='-')f=false;
while(isdigit(ch)){x=(x<<)+(x<<)+ch-'';ch=gc;}
return f?x:-x;
}
#define gi read()
int n,m,p[],g[][],f[][];
struct edge{
int to,next;
}e[*],s1[],s2[];
int cnt,last[],match[],vis[];
void insert(int a,int b){
e[++cnt]=(edge){b,last[a]};last[a]=cnt;
}
int hungary(int u){
vis[u]=;
for(int i=last[u];i;i=e[i].next){
int y=e[i].to;
if(match[y]==-){
match[y]=u;
return ;
}
}
for(int i=last[u];i;i=e[i].next){
int y=e[i].to;
if(!vis[match[y]]&&hungary(match[y])){
match[y]=u;
return ;
}
}
return ;
}
int main(){
n=gi;m=gi;
FOR1(i,n)p[i]=gi;
FOR1(i,n)FOR1(j,n){
int T=gi;
if(i^j)g[i][j]=T+p[j];
else g[i][j]=T;
f[i][j]=g[i][j];
}
//n^3 floyd
FOR1(k,n)FOR1(i,n)FOR1(j,n)gmin(f[i][j],f[i][k]+f[k][j]);
FOR1(i,m){
int a,b,c;
a=gi;b=gi;c=gi;
s1[i]=(edge){a,c};
s2[i]=(edge){b,c+g[a][b]};
}
FOR1(i,m){
match[i]=-;
FOR1(j,m)if(i^j){
if(s2[i].next+f[s2[i].to][s1[j].to]<=s1[j].next)insert(i,j);
}
}
int fyb=n;
FOR1(i,m){
memset(vis,,sizeof(vis));
if(hungary(i))--fyb;
}
printf("%d",fyb);
return ;
}

C

【题目大意】

有n个人,他们的评级是由上(upper)中(middle)下(lower)组成的

两个评级的高底是从最后一个开始比较到第一个,一个中文的世纪大难题

求出从高到低的排列顺序

【题解】分类并排序md这都什么鬼题目啊

#include<map>
#include<stack>
#include<queue>
#include<cstdio>
#include<string.h>
#include<vector>
#include<cstring>
#include<complex>
#include<iostream>
#include<assert.h>
#include<algorithm>
using namespace std;
#define inf 1001001001
#define infll 1001001001001001001LL
#define FOR0(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR1(i,n) for(int (i)=1;(i)<=(n);++(i))
#define ll long long
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl
#define gmax(a,b) (a)=max((a),(b))
#define gmin(a,b) (a)=min((a),(b))
#define ios0 ios_base::sync_with_stdio(0)
#define Ri register int
#define gc getchar()
#define il inline
il int read(){
bool f=true;
Ri x=;char ch;
while(!isdigit(ch=gc))if(ch=='-')f=false;
while(isdigit(ch)){x=(x<<)+(x<<)+ch-'';ch=gc;}
return f?x:-x;
}
#define gi read()
#define FO(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
int n;
struct data{
char name[];
int b[];
bool operator<(data B)const{
for(int i=;i<=;i++)
if(b[i]!=B.b[i]) return b[i]>B.b[i];
return strcmp(name,B.name)<;
}
}a[];
int main(){
n=gi;
FOR1(i,n){
scanf("%s",a[i].name);a[i].name[strlen(a[i].name)-]='\0';
int p=,temp[];
char str[];
while(scanf("%s",str),str[]!='c'){
if(str[]=='u')temp[++p]=;
if(str[]=='m')temp[++p]=;
if(str[]=='l')temp[++p]=-;
}
int fyb=;
while(p)a[i].b[++fyb]=temp[p--];
}
sort(a+,a+n+);
FOR1(i,n)printf("%s\n",a[i].name);
}

D

【题目大意】给定俩三角形问能不能拼成一个矩形

【题解】这你告诉我不会做回去种田吧

E

【题目大意】给定一个长度为偶数的能力值序列,要求两两分组,使得每组能力值的和的最小值最大

【题解】排序后贪心

G

【题目大意】给你一个w*h的矩形,w,h<=10^9。我们一开始在y=0的任一位置。开始移动当纵向速度是v,那么横向速度是[-v/r,v/r]之间,r是给定的小于等于10的正整数,给定10^5个点,问最多能抵达多少个点

【题解】

的题目

意给的是你移动的角度,考虑怎么转化这个东西

(r=1时的合法角度范围

首先可以推算出来,

旋转这个坐标轴是最好的做法

我们把整个平面上的所有图形绕原点顺时针旋转某个度数。

举个例子,当r=1时,原来是的坐标就变成为方便计算把它乘得到

由于角度在之间的都是合法的

那么我们就把坐标轴旋转,这么做的目的是使得移动的影响同时反映在上,而且可以计算

那么我们旋转这个度数之后,原有的,就变成了

所以我们只要对双关键字排序,第二维的LIS长度就是答案

言语有点混乱

如果哪里写错了请不要告诉我

#include<map>
#include<stack>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<complex>
#include<iostream>
#include<assert.h>
#include<algorithm>
using namespace std;
#define inf 1001001001
#define infll 1001001001001001001ll
#define FOR0(i,n) for(int (i)=0;(i)<(n);++(i))
#define FOR1(i,n) for(int (i)=1;(i)<=(n);++(i))
#define ll long long
#define dbg(vari) cerr<<#vari<<" = "<<(vari)<<endl
#define gmax(a,b) (a)=max((a),(b))
#define gmin(a,b) (a)=min((a),(b))
#define ios0 ios_base::sync_with_stdio(0)
#define Ri register int
#define gc getchar()
#define il inline
il int read(){
bool f=true;
Ri x=;char ch;
while(!isdigit(ch=gc))if(ch=='-')f=false;
while(isdigit(ch)){x=(x<<)+(x<<)+ch-'';ch=gc;}
return f?x:-x;
}
il ll read2(){
bool f=true;
ll x=;char ch;
while(!isdigit(ch=gc))if(ch=='-')f=false;
while(isdigit(ch)){x=(x<<)+(x<<)+ch-'';ch=gc;}
return f?x:-x;
}
#define gi read()
#define gl read2()
#define FO(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout);
const int N=;
struct data{ll x,c;}a[N];
int n,r,w,h;
ll x,y;
ll d[N];
bool cmp(const data&a,const data&b){
return a.c<b.c;
}
int main(){
n=gi;r=gi;w=gi;h=gi;
FOR1(i,n){
ll x,y;
x=gl;y=gl;
a[i].c=r*x+y;
a[i].x=-r*x+y;
}
sort(a+,a+n+,cmp);
d[]=-infll;
int len=;
FOR1(i,n){
if(a[i].x>=d[len])d[++len]=a[i].x;
else d[lower_bound(d+,d+len+,a[i].x)-d]=a[i].x;
}
printf("%d\n",len);
return ;
}

比赛&题面链接

http://codeforces.com/gym/100820

http://codeforces.com/gym/100819

http://codeforces.com/gym/100820/attachments/download/3912/20152016-acmicpc-pacific-northwest-regional-contest-div-1-en.pdf

http://codeforces.com/gym/100819/attachments/download/3913/20152016-acmicpc-pacific-northwest-regional-contest-div-2-en.pdf

[CFgym]2015-2016 ACM-ICPC Pacific Northwest Regional Contest小结的更多相关文章

  1. 2018 ICPC Pacific Northwest Regional Contest I-Inversions 题解

    题目链接: 2018 ICPC Pacific Northwest Regional Contest - I-Inversions 题意 给出一个长度为\(n\)的序列,其中的数字介于0-k之间,为0 ...

  2. Contest Setting 2018 ICPC Pacific Northwest Regional Contest dp

    题目:https://vj.69fa.cn/12703be72f729288b4cced17e2501850?v=1552995458 dp这个题目网上说是dp+离散化这个题目要对这些数字先处理然后进 ...

  3. 2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1)

    2018-2019 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) 思路: A Exam 思路:水题 代码: #include<bits ...

  4. ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków

    ACM ICPC Central Europe Regional Contest 2013 Jagiellonian University Kraków Problem A: Rubik’s Rect ...

  5. 2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div. 2) S Surf

    SurfNow that you've come to Florida and taken up surng, you love it! Of course, you've realized that ...

  6. 2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) Solution

    A:Alphabet Solved. 签. #include<bits/stdc++.h> using namespace std; ]; ]; int main(){ scanf(); ...

  7. 2016-2017 ACM-ICPC Pacific Northwest Regional Contest (Div. 1) K Tournament Wins

    题目链接:http://codeforces.com/gym/101201 /* * @Author: lyucheng * @Date: 2017-10-22 14:38:52 * @Last Mo ...

  8. 2017-2018 ACM-ICPC Pacific Northwest Regional Contest (Div. 1)

    A. Odd Palindrome 所有回文子串长度都是奇数等价于不存在长度为$2$的偶回文子串,即相邻两个字符都不同. #include<cstdio> #include<cstr ...

  9. 2018-2019 ACM-ICPC Pacific Northwest Regional Contest C Contest Setting(DP)

    比赛链接:Contest Setting C题 题意:$n$道题目,每道题目难度为$ai$,选择$k$道难度不同的题目,有多少种选择方案.$1<=k<=n<=1000,1<=a ...

随机推荐

  1. ./configure:command not found 解决方法

    有些下载下来的源码没有MAKEFILE文件,但是会有MAKEFILE.IN 和 configure, MAKEFILE文件则由后两个文件生成. 如果执行: $./configure   提示错误:./ ...

  2. (转)每天一个linux命令(46):vmstat命令

    vmstat是Virtual Meomory Statistics(虚拟内存统计)的缩写,可对操作系统的虚拟内存.进程.CPU活动进行监控.他是对系统的整体情况进行统计,不足之处是无法对某个进程进行深 ...

  3. unity基本操作二

    一:error1,先断网再启动点击Manual Activation点击Save License生成相应的alf文件2,联网打开https://license.unity3d.com/manual上传 ...

  4. UML类图新手入门级介绍

    UML类图新手入门级介绍 举一个简单的例子,来看这样一副图,其中就包括了UML类图中的基本图示法. 首先,看动物矩形框,它代表一个类(Class).类图分三层,第一层显示类的名称,如果是抽象类,则就用 ...

  5. Apache HTTP Server安装教程

    Apache HTTP Server安装教程 Apache HTTP Server的官方网站是:http://httpd.apache.org/,可以从中下载最新版本的Apache HTTP Serv ...

  6. void指针

    指针有两个属性:指向变量/对象的地址 和长度 但是指针只存储地址,长度则取决于指针的类型 编译器根据指针的类型从指针指向的地址向后寻址 指针类型不同则寻址范围也不同,比如: int*从指定地址向后寻找 ...

  7. android Timer and TImerTask

    android Timer and TImerTask Caused by: java.lang.IllegalStateException: TimerTask is scheduled alrea ...

  8. sql server 中 bigint 和 datetime 性能比较

    -- 创建表 create table Test_tbl ( ID varchar(40) primary key nonclustered, IntCol int, DateCol datetime ...

  9. sublime text3的配置(整理)

    一.代码片段 开发人员很多时候是在做一些重复的工作. 针对不同数据表的增删改查都差不多,重复来重去的.很久不写程序了,利用十一假期在家看看书,写写程序. 最近一直很喜欢使用Sublime Text,发 ...

  10. ORACLE AWR 和 ASH

    一.关于ASH 我们都知道,用户在 ORACLE 数据库中执行操作时,必然要创建相应的连接和会话, 其中,所有当前的会话信息都保存在动态性能视图 V$SESSION 中,通过该视图,DBA 可 以查看 ...