这场怎么说呢……有喜有悲吧。

开场先秒了 A。看到 B,感觉有点意思,WA 了 2 发后也过了。

此时还在 rk 前 200。

开 C,一看就不可做。跟榜,切 D 人数是 C 的两倍。

开 D。一眼感觉很 SB,然后就想了个假做法,WA 了 3 发。

1:10 时开始重构。再 WA1 发。结果 WA 了 4 发,才过掉。

怎么全世界的 D 都比我高分……

system test 前 predictor 说我的 rating 变化是……0。顿时很慌。

幸好 B 题 FST 了一片(DQ 和 deco 也 FST 了),rk 从 350+ 翻到了 320+。

最后 rating+=8。我还是太菜了……


A

直接模拟即可。每次找到最小的还没被删的东西,看看能删到哪里。可以 $O(m)$。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
char ch=getchar();ll x=,f=;
while(ch<'' || ch>'') f|=ch=='-',ch=getchar();
while(ch>='' && ch<='') x=x*+ch-'',ch=getchar();
return f?-x:x;
}
int m,ans;
ll n,k,p[maxn];
int main(){
n=read();m=read();k=read();
FOR(i,,m) p[i]=read();
FOR(i,,m){
ll at=(p[i]-i+k)/k;
int j=i;
while(j<=m && p[j]-i+<=at*k) j++;
j--;
i=j;ans++;
}
printf("%d\n",ans);
}

B

先判先手能不能走第一步:

  • $0$ 出现了至少两次,不行。
  • 有数出现了至少三次,不行。
  • 有数($x$)出现了至少两次,且满足条件的 $x$ 不止一个,不行。
  • 有数($x$)出现了至少两次,且 $x-1$ 也出现了,不行。(这个情况 pretest 没有,所以 FST 了一片)、
  • 否则就可以。

如果先手能走第一步,那么可以证明最后状态肯定是 $0$ 到 $n-1$ 的一个排列。判下奇偶性就可以了。

时间复杂度 $O(n\log n)$,因为要排序/map。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
char ch=getchar();ll x=,f=;
while(ch<'' || ch>'') f|=ch=='-',ch=getchar();
while(ch>='' && ch<='') x=x*+ch-'',ch=getchar();
return f?-x:x;
}
int n,a[maxn];
bool hhh;
ll s;
int main(){
n=read();
FOR(i,,n) s+=a[i]=read();
sort(a+,a+n+);
if(!a[] && a[]==a[]) return puts("cslnb"),;
FOR(i,,n-) if(a[i]==a[i-] && a[i]==a[i+]) return puts("cslnb"),;
FOR(i,,n-) if(a[i]==a[i+] && a[i]==a[i-]+) return puts("cslnb"),;
FOR(i,,n-) if(a[i]==a[i+]){
if(hhh) return puts("cslnb"),;
hhh=true;
}
puts((s-1ll*n*(n-)/)&?"sjfnb":"cslnb");
}

C

太神仙了吧……先咕着。


D

全部离散化。

枚举最小的 $y=y'$。那么只用考虑所有在 $y=y'$ 上及其上方的点。

假设 $y=y'$ 的点有 $(x_1,y'),(x_2,y')\dots(x_k,y')$,那么这些答案的和就是 $f(cnt(1,szx,y'))-f(cnt(1,x_1-1,y'))-f(cnt(x_k+1,szx,y'))-\sum\limits_{i=1}^{k-1}f(cnt(x_i+1,x_{i+1}-1,y'))$。

注意,离散化过了,离散化后所有点的最大 $x$ 坐标是 $szx$。$f(x)=\frac{x(x+1)}{2}$,也就是长度为 $x$ 的区间有多少个子区间。$cnt(l,r,a)$ 表示 $x$ 坐标在 $[l,r]$ 的点中有几个的 $y$ 坐标 $\ge a$。

(建议画图理解)

可以上扫描线+树状数组。从上往下扫。树状数组维护哪些列上有点。$cnt(l,r,y')$ 就是个区间求和。每次对于每个点,如果它所在的列还没被加入树状数组中,加入。

时间复杂度 $O(n\log n)$。

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
char ch=getchar();ll x=,f=;
while(ch<'' || ch>'') f|=ch=='-',ch=getchar();
while(ch>='' && ch<='') x=x*+ch-'',ch=getchar();
return f?-x:x;
}
int n,x[maxn],y[maxn],tmpx[maxn],tmpy[maxn],szx,szy,b[maxn],cnt[maxn];
vector<int> xs[maxn];
ll ans;
void update(int p,int v){
for(int i=p;i<=szx;i+=i&-i) b[i]+=v;
}
int query(int p){
int s=;
for(int i=p;i;i-=i&-i) s+=b[i];
return s;
}
int query(int l,int r){
if(l>r) return ;
return query(r)-query(l-);
}
int main(){
n=read();
FOR(i,,n) tmpx[i]=x[i]=read(),tmpy[i]=y[i]=read();
sort(tmpx+,tmpx+n+);szx=unique(tmpx+,tmpx+n+)-tmpx-;
sort(tmpy+,tmpy+n+);szy=unique(tmpy+,tmpy+n+)-tmpy-;
FOR(i,,n) x[i]=lower_bound(tmpx+,tmpx+szx+,x[i])-tmpx,y[i]=lower_bound(tmpy+,tmpy+szy+,y[i])-tmpy;
FOR(i,,n) xs[y[i]].push_back(x[i]);
FOR(i,,szy) sort(xs[i].begin(),xs[i].end());
ROF(i,szy,){
FOR(j,,(int)xs[i].size()-) if(++cnt[xs[i][j]]==) update(xs[i][j],);
int len=query(,szx);
ans+=1ll*len*(len+)/;
len=query(,xs[i][]-);
ans-=1ll*len*(len+)/;
len=query(xs[i][(int)xs[i].size()-]+,szx);
ans-=1ll*len*(len+)/;
FOR(j,,(int)xs[i].size()-){
len=query(xs[i][j]+,xs[i][j+]-);
ans-=1ll*len*(len+)/;
}
}
cout<<ans<<endl;
}

E

PB 说这是个 SB 题,没有思维难度,比 C 还简单……我说我不会还被喷了 QwQ

回来再说吧。


F

其实说句实话,这辈子都没想过改出 Div.1 的 F。不管了。

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

  1. Codeforces Round #182 (Div. 1)题解【ABCD】

    Codeforces Round #182 (Div. 1)题解 A题:Yaroslav and Sequence1 题意: 给你\(2*n+1\)个元素,你每次可以进行无数种操作,每次操作必须选择其 ...

  2. Codeforces Round #608 (Div. 2) 题解

    目录 Codeforces Round #608 (Div. 2) 题解 前言 A. Suits 题意 做法 程序 B. Blocks 题意 做法 程序 C. Shawarma Tent 题意 做法 ...

  3. Codeforces Round #525 (Div. 2)题解

    Codeforces Round #525 (Div. 2)题解 题解 CF1088A [Ehab and another construction problem] 依据题意枚举即可 # inclu ...

  4. Codeforces Round #528 (Div. 2)题解

    Codeforces Round #528 (Div. 2)题解 A. Right-Left Cipher 很明显这道题按题意逆序解码即可 Code: # include <bits/stdc+ ...

  5. Codeforces Round #466 (Div. 2) 题解940A 940B 940C 940D 940E 940F

    Codeforces Round #466 (Div. 2) 题解 A.Points on the line 题目大意: 给你一个数列,定义数列的权值为最大值减去最小值,问最少删除几个数,使得数列的权 ...

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

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

  7. Codeforces Round #677 (Div. 3) 题解

    Codeforces Round #677 (Div. 3) 题解 A. Boring Apartments 题目 题解 简单签到题,直接数,小于这个数的\(+10\). 代码 #include &l ...

  8. Codeforces Round #665 (Div. 2) 题解

    Codeforces Round #665 (Div. 2) 题解 写得有点晚了,估计都官方题解看完切掉了,没人看我的了qaq. 目录 Codeforces Round #665 (Div. 2) 题 ...

  9. Codeforces Round #160 (Div. 1) 题解【ABCD】

    Codeforces Round #160 (Div. 1) A - Maxim and Discounts 题意 给你n个折扣,m个物品,每个折扣都可以使用无限次,每次你使用第i个折扣的时候,你必须 ...

随机推荐

  1. 《一起学mysql》1

    自从达内毕业后就没用过mysql,一直用的hive,hdfs 存储数据,最近突然又接触到了关系型数据库.本想随便从网上 找个教程看看,但是都不是很满意,pdf看着又难受,还是自己个儿写个笔记吧.   ...

  2. php,mysql结合js解决商品分类问题,从而不必联表查询

    首先mysql数据表中的商品分类用varchar类型,比如AA,BB,CC,DD等 其次编写一个js文件,用于定义常量,比如 ‘AA’ = ‘中药’;  'BB' = '西药'; 'CC' = '保健 ...

  3. NaN不等于NaN

    目录 原因 表达式计算 类型转换 总结 不知道这个小知识点用得多不多,曾经在书上看到过,所以有一些印象,前段时间顺手写出类似如下的代码 var result; if (parseInt('abc')= ...

  4. virtualbox的安装与使用、安装镜像创建虚拟机

    1.官网:https://www.virtualbox.org/ 然后呢,点击下载: 开始安装virtualbox: 双击安装.详细安装过程见:https://baijiahao.baidu.com/ ...

  5. Bootstrap Table列宽拖动的方法

    在之前做过的一个web项目中,前端表格是基于jQuery和Bootstrap Table实现的,要求能利用拖动改变列宽,现将实现的过程记录如下: 1. Bootstrap Table可拖动,需要用到它 ...

  6. 解决eclipse中maven多模块项目显示不全的问题

    背景:在eclipse中导入maven项目,后来发现有的子模块不能正常的显示出现 原因:没有加载到子模块的pom文件 解决方法:重新导入:import-> 勾选项目->选择你缺少的项目的p ...

  7. odoo10学习笔记十六:定时任务

    转载请注明原文地址:https://www.cnblogs.com/ygj0930/p/11189382.html 一:定义定时器数据模型 模型中定义需要用到的字段.定时方法 from odoo im ...

  8. HDU4815 Little Tiger vs. Deep Monkey——0-1背包

    题目描述 对于n道题目,每道题目有一个分值,答对加分,答错不得分,你要和一个叫深猴的比赛,题目你可以假设成判断题(不是对就是错),深猴对于所有的题目都是随机选择一个答案,而你是有脑子的,求为了不输掉比 ...

  9. 3.1 Spark概述

    一.Spark简介 1.Spark的特点 特点1:运行速度快(内存计算,循环数据流.有向无环图设计机制) 把所有针对数据集的操作转换成一张有向无环图,整个执行引擎调度都是基于这个有向无环图,对这个有向 ...

  10. React 借助pubsub-js进行兄弟组件的传递值

    1===> raect中两个 兄弟组件 互相通信使用的技术 使用 消息订阅(subscribe)和发布(publish)机制 s儿 伯 s rai b pʌ b lɪ ʃ 有一个库可以处理 Pu ...