Codeforces Round #532
以后不放水题了
C.NN and the Optical Illusion
复习一下高中数学即可

$\frac{ans}{ans+r}=\sin \frac{\pi}{n}$
解方程
#include<cmath>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const double pai=acos(-);
int n,d; double a;
int main()
{
scanf("%d%d",&n,&d),a=pai/n;
printf("%f",sin(a)*d/(-sin(a)));
return ;
}
D.Dasha and Chess
先走到中间,然后背对着车最少的那个角落走,根据咕咕原理可知这边最少有 666*3/4=499.5— —也就是500 只车,而走过去只需要499步,所以一定能被将到;总步数最多499+499步
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=;
pair<int,int> rook[N];
int t1,t2,t3,kx,ky,mini;
int ocp[N][N],cnt[][];
void Check()
{
if(t1<=) exit();
}
void Move(int xx,int yy)
{
kx+=xx,ky+=yy;
if(ocp[kx][ky]) kx-=xx;
printf("%d %d\n",kx,ky),fflush(stdout);
scanf("%d%d%d",&t1,&t2,&t3),Check();
int rx=rook[t1].first,ry=rook[t1].second;
ocp[rx][ry]=false,rook[t1]=make_pair(t2,t3),ocp[t2][t3]=true;
}
int main()
{
scanf("%d%d",&kx,&ky),mini=1e9;
for(int i=;i<=;i++)
{
scanf("%d%d",&t1,&t2);
rook[i]=make_pair(t1,t2),ocp[t1][t2]=true;
}
while(kx<) Move(,);
while(kx>) Move(-,);
while(ky<) Move(,);
while(ky>) Move(,-);
for(int i=;i<=;i++)
for(int j=;j<=;j++)
if(ocp[i][j]) cnt[i>][j>]++;
for(int i=;i<=;i++)
for(int j=;j<=;j++)
if(cnt[i][j]<mini) mini=cnt[i][j];
for(int i=;i<=;i++)
for(int j=;j<=;j++)
if(cnt[i][j]==mini)
while(true) Move(i?-:,j?-:);
return ;
}
E.Andrew and Taxi
首先一定有解,构造方法是所有边都是小编号指向大编号,那么二分答案对大于答案的边跑拓扑排序检验即可
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=;
struct a
{
int u,v,w;
}edg[N];
int p[N],noww[N],goal[N];
int deg[N],idx[N],que[N],outp[N];
int n,m,f,b,t1,t2,t3,cnt,num,ans;
void Link(int f,int t)
{
noww[++cnt]=p[f],p[f]=cnt;
goal[cnt]=t,deg[t]++;
}
bool Nocir(int x)
{
num=,cnt=,f=,b=-;
memset(p,,sizeof p);
memset(deg,,sizeof deg);
for(int i=;i<=m;i++)
if(edg[i].w>x)
Link(edg[i].u,edg[i].v);
for(int i=;i<=n;i++)
if(!deg[i]) que[++b]=i;
while(f<=b)
{
int tn=que[f++]; idx[tn]=++num;
for(int i=p[tn];i;i=noww[i])
if(!(--deg[goal[i]]))
que[++b]=goal[i];
}
for(int i=;i<=n;i++)
if(deg[i]) return false;
return true;
}
int main()
{
scanf("%d%d",&n,&m);
for(int i=;i<=m;i++)
{
scanf("%d%d%d",&t1,&t2,&t3);
edg[i]=(a){t1,t2,t3},ans=max(ans,t3);
}
int l=,r=ans;
while(l<=r)
{
int mid=(l+r)/;
if(Nocir(mid)) r=mid-,ans=mid;
else l=mid+;
}
Nocir(ans);
for(int i=;i<=m;i++)
if(edg[i].w<=ans&&idx[edg[i].u]>idx[edg[i].v])
outp[++outp[]]=i;
printf("%d %d\n",ans,outp[]);
for(int i=;i<=outp[];i++)
printf("%d ",outp[i]);
return ;
}
F.Ivan and Burgers
恭喜出题人获得了“出到原题”成就
然后就被踩标算了。。。
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=,K=;
vector<pair<int,int> > ve[N];
vector<pair<int,int> > ::iterator it;
int n,m,t1,t2,val[N],ans[N],bas[K],pos[K];
void Insert(int x,int y)
{
for(int i=;~i;i--)
if(x&(<<i))
{
if(!bas[i])
{
bas[i]=x,pos[i]=y;
return;
}
if(y>pos[i])
swap(x,bas[i]),swap(y,pos[i]);
x^=bas[i];
}
}
int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%d",&val[i]);
scanf("%d",&m);
for(int i=;i<=m;i++)
{
scanf("%d%d",&t1,&t2);
ve[t2].push_back(make_pair(t1,i));
}
for(int i=;i<=n;i++)
{
Insert(val[i],i);
for(it=ve[i].begin();it!=ve[i].end();it++)
{
int lef=it->first,idx=it->second;
for(int j=;~j;j--)
if(pos[j]>=lef&&(ans[idx]^bas[j])>ans[idx])
ans[idx]^=bas[j];
}
}
for(int i=;i<=m;i++)
printf("%d\n",ans[i]);
return ;
}
Codeforces Round #532的更多相关文章
- Codeforces Round #532 (Div. 2)
Codeforces Round #532 (Div. 2) A - Roman and Browser #include<bits/stdc++.h> #include<iostr ...
- Codeforces Round #532 (Div. 2) 题解
Codeforces Round #532 (Div. 2) 题目总链接:https://codeforces.com/contest/1100 A. Roman and Browser 题意: 给出 ...
- Codeforces Round #532 (Div. 2) F 线性基(新坑) + 贪心 + 离线处理
https://codeforces.com/contest/1100/problem/F 题意 一个有n个数组c[],q次询问,每次询问一个区间的子集最大异或和 题解 单问区间子集最大异或和,线性基 ...
- Codeforces Round #532 (Div. 2):F. Ivan and Burgers(贪心+异或基)
F. Ivan and Burgers 题目链接:https://codeforces.com/contest/1100/problem/F 题意: 给出n个数,然后有多个询问,每次回答询问所给出的区 ...
- Codeforces Round #532 (Div. 2)- B(思维)
Arkady coordinates rounds on some not really famous competitive programming platform. Each round fea ...
- Codeforces Round #532(Div. 2) C.NN and the Optical IIIusion
链接:https://codeforces.com/contest/1100/problem/C 题意: 一个圆球外面由其他圆球包裹,两两相连. 给出n,r. n为外面圆球数量,r为内部圆球半径. 求 ...
- Codeforces Round #532(Div. 2) B.Build a Contest
链接:https://codeforces.com/contest/1100/problem/B 题意: 给n,m. 给m个数,每个数代表一个等级,没给一个将其添加到题目池中,当题目池中有难度(1-n ...
- Codeforces Round #532(Div. 2) A.Roman and Browser
链接:https://codeforces.com/contest/1100/problem/A 题意: 给定n,k. 给定一串由正负1组成的数. 任选b,c = b + i*k(i为任意整数).将c ...
- Codeforces Round #532 (Div. 2) E. Andrew and Taxi(二分+拓扑排序)
题目链接:https://codeforces.com/contest/1100/problem/E 题意:给出 n 个点 m 条边的有向图,要翻转一些边,使得有向图中不存在环,问翻转的边中最大权值最 ...
随机推荐
- Windows下LimeSDR Mini使用说明
本文内容.开发板及配件仅限用于学校或科研院所开展科研实验! 淘宝店铺名称:开源SDR实验室 LimeSDR链接:https://item.taobao.com/item.htm?spm=a230r.1 ...
- 【Docker】第三篇 Docker容器管理
一.Docker容器概述: 简单理解容器是镜像的一个实例. 镜像是静态的只读文件,而容器的运行需要可写文件层. 二.创建容器 [root@web130 ~]# docker create -it ub ...
- 天马行空云计算(二)-Hardware&Hypervisor介绍
天马行空云计算系列一介绍了总体抽象视图,本篇展开Hardware&Hypervisor 介绍.如下是介绍大纲: 本篇将基于上述架构从如下方面介绍说明 Linux设备驱动 因为上述提到的一些硬件 ...
- 配置tensorflow环境(anaconda+jupyter notebook)
很早之前,tensorflow环境之前我也曾装过,但是用的不是很舒服,很多问题都不明所以然.今天想要系统地学习一下tensorflow,于是又重新搭建了一遍,这次还是踩了不少坑.特此写下此文,供有兴趣 ...
- MegaCli64/MegaCli命令详解
基础命令学习目录首页 MegaCli64 -LDInfo -Lall -aALL这个命令能看到RAID的状态MegaCli64 -LDSetProp ForcedWB -L0 -a0MegaCli64 ...
- JS特效@缓动框架封装及应用
| 版权声明:本文为博主原创文章,未经博主允许不得转载. 一.变量CSS样式属性获取/赋值方法 给属性赋值:(既能获取又能赋值) 1)div.style.width 单个赋值:点语法,这个方法比较固定 ...
- 互评Alpha版本—SkyHunter
1.根据NABCD评论作品: N(Need,需求):飞机大战题材的游戏对80,90后的人来说算是童年的记忆,可以在闲暇之余打开电脑玩一会儿.但是面向初中生,高中生的话这种PC小游戏可能不会那么适合 ...
- ns3 模拟无线网络通信
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * This program is fre ...
- Java中的常见异常
非检查异常:Error 和 RuntimeException 以及他们的子类.0错误ArithmeticException,错误的强制类型转换错误ClassCastException,数组索引越界Ar ...
- Java:JUnit4使用详解
对于Junit的总是一知半解不太懂,现在认真梳理一下: 此次针对的是Junit4版本,注解也是在Junit4版本才有的,之前的版本并无注解功能.而注解开发基本上被认为是一种优秀的设计,所以我们写单元测 ...