Preface

军训终于结束了回来补一补之前的坑发现很多题目题意都忘记了

这场感觉难度适中,F由于智力不够所以弃了,E的话石乐志看了官方英文题解才发现自己已经胡了一大半就差实现了233

水平下降严重.jpg


A. Tokitsukaze and Discard Item

CNM我SB模拟题要WA那么多发还是退役算了万恶的long long

#include<cstdio>
#define RI register int
#define CI const int&
const int N=100005;
int m,ans; long long n,k,a[N],id,nw;
int main()
{
RI i,j; for (scanf("%I64d%d%I64d",&n,&m,&k),i=1;i<=m;++i)
scanf("%I64d",&a[i]); for (i=1;i<=m;)
for (id=(a[i]-(i-1)-1)/k+1,j=i+1;j<=m+1;++j)
if (j==m+1||(nw=(a[j]-(i-1)-1)/k+1)!=id) { ++ans; i=j; break; }
return printf("%d",ans),0;
}

B. Tokitsukaze, CSL and Stone Game

本来想和陈指导比一下看谁WA的多的,最后我以多一次的好成绩力压了他

这题比较繁琐,大体思路就是先判断第一个人是否必输,这个需要考虑各种情况,具体看代码

然后我们发现接下来每个数能被拿的数量数固定的,而且在着之上双方都有保证自己操作合法的方法,因此统计下能拿的数目的总数判断下奇偶性即可

#include<cstdio>
#include<map>
#define RI register int
#define CI const int&
using namespace std;
const int N=100005;
int n,a[N],num_mx,tot; map <int,int> ct; long long sum;
int main()
{
RI i; for (scanf("%d",&n),i=1;i<=n;++i)
{
scanf("%d",&a[i]);
if (++ct[a[i]]>num_mx) num_mx=ct[a[i]];
}
if (ct[0]>=2) return puts("cslnb"),0;
if (ct[0]&&ct[0]+ct[1]==n) return puts("cslnb"),0;
if (num_mx>=3) return puts("cslnb"),0;
for (map <int,int>::iterator it=ct.begin();it!=ct.end();++it)
if (it->second>=2) ++tot; if (tot>=2) return puts("cslnb"),0;
for (i=1;i<=n;++i) if (ct[a[i]]>=2&&ct[a[i]-1]) return puts("cslnb"),0;
/*bool flag=0; for (i=1;i<=n;++i) if (a[i]&&!ct[a[i]-1])
{ flag=1; break; } if (!flag) return puts("cslnb"),0;*/
for (i=1;i<=n;++i) sum+=a[i]-i+1; return puts(sum&1?"sjfnb":"cslnb"),0;
}

C. Tokitsukaze and Duel

又是坑提交的博弈题,发现我猜起结论来倒是挺NB的

首先判断第一个人能否一击必胜,否则它要么输掉要么平局(否则另一个人至少可以不断操作和它一样的区间来抵消影响)

那么接下来我们考虑枚举第一个人的所有操作情况,如果任一情况下没有导致必胜态出现就能打成平局,否则就是输掉(结合SG函数的定义理解一下)

那么我们到底需不需要枚举每一种情况呢,容易发现如果染中间的某一段一旦出现了非同色点在区间两边的情况就必然不可能输掉,因此只要判断染两个端点的即可

#include<cstdio>
#include<cstring>
#define RI register int
#define CI const int&
using namespace std;
const int N=100005;
int n,k,pfx[N],tp,all; char s[N],ts[N];
inline bool is_win(char *s,CI n)
{
RI i; for (all=0,i=1;i<=n;++i) pfx[i]=pfx[i-1]+s[i]-'0',all+=s[i]-'0';
for (i=1;i+k-1<=n;++i) if (tp=all-(pfx[i+k-1]-pfx[i-1]),!tp||tp==n-k)
return 1; return 0;
}
int main()
{
RI i; scanf("%d%d%s",&n,&k,s+1); if (is_win(s,n)) return puts("tokitsukaze"),0;
for (memcpy(ts,s,sizeof(s)),i=2;i<=k+1;++i) ts[i]='0';
if (!is_win(ts,n)) return puts("once again"),0;
for (memcpy(ts,s,sizeof(s)),i=2;i<=k+1;++i) ts[i]='1';
if (!is_win(ts,n)) return puts("once again"),0;
for (memcpy(ts,s,sizeof(s)),i=2;i<=k+1;++i) ts[n-i+1]='0';
if (!is_win(ts,n)) return puts("once again"),0;
for (memcpy(ts,s,sizeof(s)),i=2;i<=k+1;++i) ts[n-i+1]='1';
if (!is_win(ts,n)) return puts("once again"),0;
return puts("quailty"),0;
}

D. Tokitsukaze and Strange Rectangle

套路题,考虑每个点作为底边的贡献,这样我们就可以把点按\(y\)从大到小排序,然后一起考虑同一层

首先我们发现如果这一层只有一个点时,只要统计出所有不同的\(x\)坐标的种类数然后计算点对即可

那么多个点呢,考虑中间的点只会被两端重复计算,因此直接容斥减去中间的情况即可

离散化之后用树状数组维护点数目即可

#include<cstdio>
#include<vector>
#include<algorithm>
#define RI register int
#define CI const int&
using namespace std;
const int N=200005;
struct Point
{
int x,y;
friend inline bool operator < (const Point& A,const Point& B)
{
return A.y!=B.y?A.y>B.y:A.x<B.x;
}
}p[N]; int n,rst[N],num; long long ans;
inline long long S(CI x)
{
return 1LL*x*(x+1)>>1LL;
}
class Tree_Array
{
private:
int bit[N]; bool vis[N];
#define lowbit(x) x&-x
inline int get(RI x,int ret=0)
{
for (;x;x-=lowbit(x)) ret+=bit[x]; return ret;
}
public:
inline void add(RI x)
{
if (vis[x]) return; for (vis[x]=1;x<=num;x+=lowbit(x)) ++bit[x];
}
inline int query(CI l,CI r)
{
if (l>r) return 0; return get(r)-get(l-1);
}
#undef lowbit
}BIT;
int main()
{
RI i,j,k; for (scanf("%d",&n),i=1;i<=n;++i)
scanf("%d%d",&p[i].x,&p[i].y),rst[i]=p[i].x;
sort(rst+1,rst+n+1); num=unique(rst+1,rst+n+1)-rst-1;
for (i=1;i<=n;++i) p[i].x=lower_bound(rst+1,rst+num+1,p[i].x)-rst;
for (sort(p+1,p+n+1),p[n+1].x=num,p[n+1].y=1e9+1,i=1;i<=n;i=j+1)
{
for (j=i;p[j].y==p[j+1].y;++j);
for (k=i;k<=j;++k) BIT.add(p[k].x); ans+=S(BIT.query(1,num));
for (k=i+1;k<=j;++k) ans-=S(BIT.query(p[k-1].x+1,p[k].x-1));
ans-=S(BIT.query(1,p[i].x-1)); ans-=S(BIT.query(p[j].x+1,num));
}
return printf("%I64d",ans),0;
}

E. Tokitsukaze and Explosion

看到这题之后就随便口胡了一个做法,然后就基本正解了?

首先我们转化问题,考虑以原点为圆心做一个半径为\(d\)的圆,那么所有直线不能与圆相交

显然半径\(d\)可以二分,再考虑已知半径的时候直线必然与圆相切,因为不相切的直线向圆心平移显然不会更劣

然后我们就可以得出一条直线所能覆盖的一个极角范围了,因此原问题转化为能否用\(m\)条线段覆盖环上的\(n\)个点

考虑破环为链,我们枚举起点之后看看贪心地向后覆盖\(m\)条线段后能否绕回这个点

但是直接这么做显然时\(O(n^2)\)的,然后稍微一想就会发现可以倍增处理出每个点向后跳\(2^i\)后最远能到达的点,然后再枚举起点就可以了

复杂度\(O(n\log^2 n)\),可以轻松地跑过

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
#define RI register int
#define CI const int&
using namespace std;
typedef double DB;
const int N=100005,P=20,INF=2e9;
const DB EPS=1e-10,tpi=2.0*acos(-1);
struct segment
{
DB l,r; int tp;
inline segment(const DB& X=0,const DB& Y=0,CI Tp=0)
{
l=X; r=Y; tp=Tp;
}
friend inline bool operator < (const segment& A,const segment& B)
{
return A.tp!=B.tp?A.tp<B.tp:A.l<B.l;
}
}sg[N<<1]; int n,m,tot,x[N],y[N],nxt[N<<1][P];
DB dis[N],mi=INF,ans; bool c[N<<1];
inline bool check(const DB& lim)
{
RI i,j; for (tot=0,i=1;i<=n;++i)
{
DB deg=atan2(y[i],x[i]),rg=acos(lim/dis[i]);
sg[++tot]=segment(deg-rg,deg+rg,0);
sg[++tot]=segment(deg-rg+tpi,deg+rg+tpi,1);
}
DB mr=INF; memset(c,1,tot+1);
for (sort(sg+1,sg+tot+1),i=tot;i;--i)
if (sg[i].r<mr) mr=sg[i].r; else c[i]=0;
for (tot=0,i=1;i<=n;++i) if (c[i]) sg[++tot]=sg[i];
for (i=1;i<=tot;++i) sg[tot+i]=segment(sg[i].l+tpi,sg[i].r+tpi,1);
for (tot<<=1,i=j=1;i<=tot;++i)
{
while (j<=tot&&sg[i].r>=sg[j].l) ++j;
nxt[i][0]=j;
}
for (j=1;j<P;++j) for (i=1;i<=tot;++i)
nxt[i][j]=nxt[nxt[i][j-1]][j-1];
for (i=1;(i<<1)<=tot;++i)
{
int p=i; for (j=0;j<P;++j) if ((m>>j)&1) p=nxt[p][j];
if (!p||p>=i+(tot>>1)) return 1;
}
return 0;
}
int main()
{
RI i; for (scanf("%d%d",&n,&m),i=1;i<=n;++i)
scanf("%d%d",&x[i],&y[i]),dis[i]=sqrt(1LL*x[i]*x[i]+1LL*y[i]*y[i]),mi=min(mi,dis[i]);
DB l=0,r=mi,mid; while (r-l>EPS)
if (check(mid=(l+r)/2.0)) ans=mid,l=mid; else r=mid;
return printf("%.10lf",ans),0;
}

F. Tokitsukaze and Powers

题意都那么麻烦就咕咕咕了


Postscript

一场比赛前几题都是博弈,这对于我来说就是罚时起飞的节奏

看来我还是适合做套路题233

Codeforces Round #573 (Div. 1)的更多相关文章

  1. Codeforces Round #573 (Div. 1) 差F

    Codeforces Round #573 (Div. 1) E 题意:二维平面上有 n 个点,你可以放至多 m 条直线使得 (0,0) 与每个点的连线至少与一条直线相交.求原点与所有直线的距离最小值 ...

  2. Codeforces Round 573 (Div.1) 题解

    这场怎么说呢……有喜有悲吧. 开场先秒了 A.看到 B,感觉有点意思,WA 了 2 发后也过了. 此时还在 rk 前 200. 开 C,一看就不可做.跟榜,切 D 人数是 C 的两倍. 开 D.一眼感 ...

  3. Codeforces Round #573 (Div. 2) Tokitsukaze and Mahjong 水题

    B. Tokitsukaze and Mahjong time limit per test1 second memory limit per test256 megabytes Tokitsukaz ...

  4. Codeforces Round #573 (Div. 2) D. Tokitsukaze, CSL and Stone Game (博弈,思维)

    D. Tokitsukaze, CSL and Stone Game time limit per test1 second memory limit per test256 megabytes in ...

  5. Codeforces Round #573 (Div. 2) E. Tokitsukaze and Duel (博弈)

    time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...

  6. Codeforces Round #573 (Div. 2)

    A:Tokitsukaze and Enhancement 当时看错条件了..以为A>C>B>D.就胡写了判断条件. #include<bits/stdc++.h> us ...

  7. Codeforces Round #573 (Div. 2) D题题解

    一.题目 ​ Tokitsukaze, CSL and Stone Game ​ Tokitsukaze和CSL正在玩一些石头游戏. ​ 一开始,有n堆的石头,第i堆石头数记为 \(a_i\),两人轮 ...

  8. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. 【2019.10.7 CCF-CSP-2019模拟赛 T2】绝对值(abs)(线段树细节题)

    找规律 设\(p_i=a_{i+1}-a_i\),则答案就是\(\sum_{i=1}^{n-1}p_i\). 考虑若将\(a_i\)加上\(x\)(边界情况特殊考虑),就相当于是将\(p_{i-1}\ ...

  2. AutoCAD配置的Heidi驱动程序未加载

    电脑安装的软件越来越多,有的软件也就偶尔使用一下下,于是就找了一个绿化版的AutoCAD,挺好的,可启动时弹出"配置的Heidi驱动程序未加载.切换到默认软件驱动程序". 对于上述 ...

  3. OpenDaylight开发hello-world项目之功能实现

    OpenDaylight开发hello-world项目之开发环境搭建 OpenDaylight开发hello-world项目之开发工具安装 OpenDaylight开发hello-world项目之代码 ...

  4. 第四组项目总结(UML图设计)

    第四组项目总结(UML图设计) 相关链接: 墨刀原型链接:https://pan.baidu.com/s/1qrVI_je8NONVHT_FwH6Pwg 需求文档链接:https://www.cnbl ...

  5. vscode 笔记

    设置中文 查看 --> 命令面板 --> 输入: change display language , 安装 中文, 重启 vscode . markdown 转 pdf 安装 Markdo ...

  6. Update 19.11 for Azure Sphere

    今天,微软发布了面向Azure Sphere的19.11更新,其主要亮点就是加入了对开发工具Visual Studio Code和Linux开发环境的支持.具体来讲,本次更新包含3个部分: 1. Az ...

  7. js判断浏览器是否安装或启用了flash的方法总结

    目录 # js判断浏览器是否安装或启用了flash的方法 # chrome浏览器启用flash插件的方法 # 参考 # js判断浏览器是否安装或启用了flash的方法 在传统浏览器,可以使用windo ...

  8. SpringBoot系列之profles配置多环境(篇二)

    SpringBoot系列之profles配置多环境(篇二) 继续上篇博客SpringBoot系列之profles配置多环境(篇一)之后,继续写一篇博客进行补充 写Spring项目时,在测试环境是一套数 ...

  9. P3376 网络最大流模板(Dinic + dfs多路增广优化 + 炸点优化 + 当前弧优化)

    ### P3376 题目链接 ### 这里讲一下三种优化的实现以及正确性. 1.dfs多路增广优化 一般的Dinic算法中是这样的,bfs() 用于标记多条增广路,以至于能一次 bfs() 出多次 d ...

  10. Ubuntu安装CUDA、CUDNN比较有用的网址总结

    Ubuntu安装CUDA.CUDNN比较有用的网址总结 1.tensorflow各个版本所对应的的系统要求和CUDA\CUDNN适配版本 https://tensorflow.google.cn/in ...