终判才知道自己失了智。本场据说是chinese专场,可是请允许我吐槽一下题意!

A. An abandoned sentiment from past

shabi贪心手残for循环边界写错了竟然还过了初判。回宿舍想想发现只要k大于1,可以直接输出Yes的。

const int N=1e6+5;
int a[N],b[N];
//char s[N];
int cmp(int a,int b)
{
return a>b;
}
int main()
{
int n,k;
while(~scanf("%d%d",&n,&k))
{
int num=0;
for(int i=0; i<n; i++)
{
scanf("%d",&a[i]);
if(!a[i]) num++;
}
for(int i=0; i<k; i++) scanf("%d",&b[i]);
sort(b,b+k,cmp);
int f=0,j=0;
for(int i=0; i<n; i++) if(a[i]==0&&j<k) a[i]=b[j++];
for(int i=1; i<n; i++) if(a[i]<=a[i-1]) f=1;
if(f) puts("Yes");
else puts("No");
}
return 0;
}

B.
An express train to reveries

被题意坑了一发,然而终判还是跪了。

根据题意:题目保证有解,结合样例只能有一组或者两组不同。一组的话随便输出一个没有出现过的数,注意范围。而两组的话可以直接暴力四种情况暴力判。比赛时却纠结怎么写,石乐志。关键在与证明最多只有两组不同。

int judge()
{
cls(vis,0);
for(int i=1;i<=n;i++)
{
if(vis[c[i]]) return 0;
vis[c[i]]++;
}
return 1;
}
int main()
{
while(~scanf("%d",&n))
{
cls(vis,0);
int num=0;//不同对的数量;
for(int i=1; i<=n; i++)
{
scanf("%d",&a[i]);
vis[a[i]]=1;
}
for(int i=1; i<=n; i++)
{
scanf("%d",&b[i]);
vis[b[i]]=1;
if(a[i]!=b[i]) num++;
}
if(num==1)
{
for(int i=1; i<=n; i++)
if(a[i]!=b[i])
{
for(int j=1; j<=n; j++)
if(!vis[j])
{
printf("%d ",j);
break;
}
}
else printf("%d ",a[i]);
}
else
{
int pos1=0,pos2=0;
for(int i=1; i<=n; i++)
{
if(a[i]==b[i]) c[i]=a[i];
else
{
if(!pos1) pos1=i;
else pos2=i;
}
}
c[pos1]=a[pos1],c[pos2]=a[pos2];
if(!judge())
{
c[pos1]=a[pos1],c[pos2]=b[pos2];
if(!judge())
{
c[pos1]=b[pos1],c[pos2]=a[pos2];
if(!judge())
c[pos1]=b[pos1],c[pos2]=b[pos2];
}
}
for(int i=1; i<=n; i++) printf("%d ",c[i]);
} puts("");
}
return 0;
}
//4
//3 2 1 3
//4 2 1 2

C.
An impassioned circulation of affection

全场唯一过的一道题。6e8在CF2s能过(手动滑稽

一个shabi滑动窗,结合样例猜了一发发现比B题还好写,结果又是细节上bug了半天,怎么办,我好像石乐志。。

const int N=1500+5;
int a[N][26];
char s[N];
int main()
{
int n,q;
while(~scanf("%d%s",&n,s+1))
{
memset(a,0,sizeof(a));
for(int i=1; i<=n; i++)
{
for(int j=0; j<26; j++) a[i][j]=a[i-1][j];
a[i][s[i]-'a']++;
}
scanf("%d",&q);
int k;
char str[5];
while(q--)
{
scanf("%d%s",&k,str);
int j=1,len=0;
int id=(str[0]-'a');
for(int i=1; i<=n; i++)
{
while(j<=n&&(j-i+1-(a[j][id]-a[i-1][id]))<=k) j++;
len=max(len,j-i);
}
printf("%d\n",len);
}
}
return 0;
}

怎么办,好久没写代码思维好像没有度假,但代码能力急剧下滑,怎么办,好慌。。。。

%一把Qls,当我做完B题时却发现QLS已经过了B题和D题。。。。不给弱鸡留活路啊。。

Codeforces Round #418 (Div. 2) A+B+C!的更多相关文章

  1. Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque

    Codeforces Round #418 (Div. 2) D. An overnight dance in discotheque 题意: 给\(n(n <= 1000)\)个圆,圆与圆之间 ...

  2. Codeforces Round #418 (Div. 2).C two points

    C. An impassioned circulation of affection time limit per test 2 seconds memory limit per test 256 m ...

  3. Codeforces Round #418 (Div. 2)

    A: 不细心WA了好多次 题意:给你一个a序列,再给你个b序列,你需要用b序列中的数字去替换a序列中的0,如果能够替换,则需要判断a是否能构成一个非递增的序列,a,b中所有的数字不会重复 思路:就是一 ...

  4. Codeforces Round #418 (Div. 2) B. An express train to reveries

    time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...

  5. Codeforces Round #418 (Div. 2)D

    给n个圆要么包含,要么相分离,没有两个公共点,当成一棵树,把包含的面积大的放在上面 如图最上面的par记为-1,level记为0,当par==-1||level==1时就加否则减, 就是第一,二层先加 ...

  6. Codeforces Round #418 (Div. 2) C

    Description Nadeko's birthday is approaching! As she decorated the room for the party, a long garlan ...

  7. Codeforces Round #418 (Div. 2) B

    Description Sengoku still remembers the mysterious "colourful meteoroids" she discovered w ...

  8. Codeforces Round #418 (Div. 2) A

    Description A few years ago, Hitagi encountered a giant crab, who stole the whole of her body weight ...

  9. Codeforces Round #418 (Div. 2) C. An impassioned circulation of affection

    C. An impassioned circulation of affection time limit per test 2 seconds memory limit per test 256 m ...

随机推荐

  1. Codeforces Round #327 (Div. 2) B Rebranding(映射)

    O(1)变换映射,最后一次性替换. #include<bits/stdc++.h> using namespace std; typedef long long ll; ; char s[ ...

  2. 【洛谷2468】[SDOI2010] 粟粟的书架(二合一)

    点此看题面 大致题意: 问你选取一个矩形区间内至少几个数,才能使它们的和\(\ge H_i\). 二合一 根据数据范围,比较显然能看出它是一道二合一的题目. 对于第一种情况,\(R,C\le 200\ ...

  3. [论文理解]Focal Loss for Dense Object Detection(Retina Net)

    Focal Loss for Dense Object Detection Intro 这又是一篇与何凯明大神有关的作品,文章主要解决了one-stage网络识别率普遍低于two-stage网络的问题 ...

  4. python_49_三种编程方式及面向过程与面向函数区别.py

    ''' 三种编程方式:1.面向对象 (类:class)2.面向过程 (过程:def)3.函数式编程(函数:def) 编程语言中函数的定义:函数是逻辑结构化和过程化的一种编程方法 过程与函数的区别,过程 ...

  5. Matlab 中实用数据结构之 containers.Map

    概要   熟悉 Python 的都知道字典 Dict 类型数据结构功能的强大,Matlab 中虽然有表结构,但是其列名必须是亦变量名类型的字符串,如果我想用数字开头的字符串作键值,其表结构就无能为力了 ...

  6. Bzoj 1081 [Ahoi2009] chess 中国象棋

    bzoj 1081 [Ahoi2009] chess 中国象棋 题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1801 状态比较难设,的确 ...

  7. [BZOJ] 3875: [Ahoi2014&Jsoi2014]骑士游戏

    设\(f[x]\)为彻底杀死\(x\)号怪兽的代价 有转移方程 \[ f[x]=min\{k[x],s[x]+\sum f[v]\} \] 其中\(v\)是\(x\)通过普通攻击分裂出的小怪兽 这个东 ...

  8. 在Linux下搜索文件

    在Linux下搜索文件============================= 1,which 查找可执行文件的绝对路径 [root@aminglinux ~]# which cat /bin/ca ...

  9. 配置vim nginx.conf高亮

    #!/bin/bashwget http://www.vim.org/scripts/download_script.php?src_id=14376 -O nginx.vimmv nginx.vim ...

  10. 精读《sqorn 源码》

    1 引言 前端精读<手写 SQL 编译器系列> 介绍了如何利用 SQL 生成语法树,而还有一些库的作用是根据语法树生成 SQL 语句. 除此之外,还有一种库,是根据编程语言生成 SQL.s ...