一年只有两场 cf,一场 Goodbye,一场 April Fools Day Contest。

年年 B 题都有毒,去年摸猫,今年暴力窃取输入数据。

青名大佬kit1980今年又回来出愚人节了,感觉题目质量还是比去年高的。虽然他出的题好像没什么人做出来。

A. Thanos Sort

Upsolved.

传送门

签到题。灭霸排序,每次将数组的前一半或后一半移除,直到数组有序为止。问可能的灭霸排序后数组的最长长度。

这题一点也不 April Fool,比赛时直接跳了。怎么做都能过。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def sor(x):
t=x[0]
for i in x:
if t>i:return False
t=i
return True

input()
x=list(map(int,input().split()))
ans=0
for i in range(5):
l=1<<i
for j in range(0,len(x)-l+1,l):
if sor(x[j:j+l]):
ans=max(ans,l)
print(ans)

B. Kanban Numbers

Solved. 01:14 (+104)

传送门

为什么交了这么多发?

大概是二分了每一个输入的输出

比赛时候不知道啥是“看板”(Kanban),头铁怼这个题,过了以后已经头昏眼花了。过的时候依然不知道什么是“看板”。

正解: Kan Ban Numbers, 即英语拼写时不出现 k、a、n 字母的数。

???我是怎么过的这题

数据除了样例全是升序,大概是吃了这个好处吧

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include<bits/stdc++.h>
using namespace std;
int main(){
int x;cin>>x;
if (x==5)puts("YES");
else if (x==13)puts("NO");
else if (x==24)puts("NO");
else if (x==46)puts("YES");
else if (x==1)puts("NO");
else if (x==2)puts("YES");
else if (x==3)puts("YES");
else if (x==4)puts("YES");
else if (x==10)puts("NO");
else if (x==11)puts("NO");
else if (x==12)puts("YES");
else if (x==16)puts("NO");
else if (x==20)puts("NO");
else if (x==28)puts("NO");
else if (x==30)puts("YES");
else if (x==35)puts("YES");
else if (x==37)puts("NO");
else if (x==41)puts("NO");
else if (x==43)puts("YES");
else if (x==49)puts("NO");
else if (x<=70)puts("YES");
else if (x<=75)puts("NO");
else if (x<=90)puts("YES");
else if (x<=99)puts("NO");
else if (x>99)return -1;
else puts("NO");
}

C. Mystery Circuit

Upsolved.

传送门

出题人 Nickolas 同时是 Microsoft Q# Coding Contest 的出题人。看到这个电路图,想到量子门。

查了 wiki,从左到右分别是NOT门、Controlled NOT门、Toffoli门。第四个不知道是什么,猜了一下应该和前两个类似,若下面三条线路都是1,第四条线路取反,否则不变。

比赛时手玩样例失败了,感觉前年也是少一道电路题?

1
2
3
4
5
6
7
8
#include<bits/stdc++.h>
using namespace std;
int main(){
int x;cin>>x;
int a=x&8,b=x&4,c=x&2,d=x&1;
int A=a^8,B=(A>>1)^b,C=((A>>2)&(B>>1))^c,D=((A>>3)&(B>>2)&(C>>1))^d;
cout<<A+B+C+D<<endl;
}

D. Pigeon d’Or

Solved. 01:54 (+2)

传送门

题面很多拼写错误。英语水平不好,贴到 Word 里看看哪些单词错了啥。

发现错的字母连起来是有含义的: ftying, saniwation, tronsform -> two

连起来以后的结果是: two plus xor of third and min elements

1
2
3
input()
a=list(map(int,input().split()))
print(2+(a[2]^min(a)))

E. Fourier Doodles

Unsolved.

传送门

F. Neat Words

Solved. 01:43 (+)

传送门

neat (adj.): ②(well presented) 工整的 gōngzhěng de ‹handwriting, stitching› (来自英汉词典)

观察样例,NEATAIJUROR,写出来要不全都是直线,要不每个字母都带曲线。

于是得到题意: 求一个单词的每个字母是否全都是直的/全都带曲线的

1
2
3
4
5
6
7
8
9
10
11
n=input()
s='AEFHIKLMNTVWXYZ'
t='BCDGJOPQRSU'
f1=0
f2=0
for i in s:
if i in n:f1=1
for i in t:
if i in n:f2=1
if f1+f2==1:print('YES')
else:print('NO')

G. AI Takeover

Unsolved.

传送门