这次是中国大佬出题,结果被虐惨了。

A. Nauuo and Votes

 #include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
int x, y, z;
int main(){
scanf("%d%d%d", &x, &y, &z);
if(x + z - y < ) puts("-");
else if(x - y - z > ) puts("+");
else if(x == y && z == ) puts("");
else puts("?");
}

CF1173A

B. Nauuo and Chess

 #include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
int n, m;
int main(){
scanf("%d", &n);
m = (n >> ) + ;
printf("%d\n", m);
for(Rint i = ;i <= m;i ++)
printf("%d %d\n", , i);
for(Rint i = ;i <= n - m + ;i ++)
printf("%d %d\n", i, m);
}

CF1173B

C. Nauuo and Cards

(乱搞能力有待加强)

首先我们分两种情况,手上会拿到1和不会拿到1.

对于后者,初始的时候1要在队列中并且它之后是$2,3,4,\ldots,i-1$,然后之后可以把$i,i+1,\ldots,n$放进队列中,需要$n-i+1$步。

对于前者,用$p_i$表示$i$初始在队列的位置,不在则为0,也就是至少$p_i$步之后可以拿到这张牌,将$i$从$p_i$这个位置转移到$i$需要$p_i-i+n+1$步,取最大值即为答案。

感性理解:首先如果后者可以那么后者一定比前者更优,对于前者,我们可以通过先扔一些空牌来拿到足够的牌,然后依次把$1,2,3,\ldots n$扔出去,不会更优。

 #include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = ;
int n, a[N], b[N], p[N], ans;
int main(){
scanf("%d", &n);
for(Rint i = ;i <= n;i ++){
scanf("%d", a + i); p[a[i]] = ;
}
for(Rint i = ;i <= n;i ++){
scanf("%d", b + i); p[b[i]] = i;
}
if(p[]){
int i, j;
for(i = ;p[i] == p[] + i - ;i ++);
if(p[i - ] == n){
for(j = i;j <= n && p[j] <= j - i;j ++);
if(j > n){
printf("%d\n", n - i + );
return ;
}
}
}
for(Rint i = ;i <= n;i ++) ans = max(ans, p[i] - i + n + );
printf("%d", ans);
}

CF1172A

D. Nauuo and Circle

我们发现,对于节点$x$的子树,它在排列中必定是一段连续的区间,否则就会跟其他的子树导致边相交。

这个排列是可以旋转的,所以钦定$p_1=1$。

设节点$i$的度数为$deg_i$。

我们使用捆绑法,将必须要连在一起的先捆绑起来,之后再对子树进行递归。

例如样例1,2就是这样的:

$$(1,(2,4),3)$$

$$(1,2,3,4)$$

(同个括号里的表示必须要连续)

对于节点$1$,我们可以任意排列它的$deg_1$棵子树,对于其他节点$x$,我们可以排列它自己和$deg_x-1$棵子树

$$Ans=n\prod_{i=1}^ndeg_i!$$

 #include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
const int N = , mod = ;
int n, fac[N], deg[N], ans;
int main(){
scanf("%d", &n);
for(Rint i = ;i < n;i ++){
int a, b;
scanf("%d%d", &a, &b);
deg[a] ++; deg[b] ++;
}
fac[] = ans = ;
for(Rint i = ;i <= n;i ++) fac[i] = (LL) i * fac[i - ] % mod;
for(Rint i = ;i <= n;i ++) ans = (LL) ans * fac[deg[i]] % mod;
printf("%d\n", (LL) ans * n % mod);
}

CF1137D

Codeforces Round #564 比赛总结的更多相关文章

  1. Codeforces Round #564 (Div. 1)

    Codeforces Round #564 (Div. 1) A Nauuo and Cards 首先如果牌库中最后的牌是\(1,2,\cdots, k\),那么就模拟一下能不能每次打出第\(k+i\ ...

  2. Codeforces Round #564(div2)

    Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...

  3. Codeforces Round #564 (Div. 2) C. Nauuo and Cards

    链接:https://codeforces.com/contest/1173/problem/C 题意: Nauuo is a girl who loves playing cards. One da ...

  4. Codeforces Round #564 (Div. 2) B. Nauuo and Chess

    链接:https://codeforces.com/contest/1173/problem/B 题意: Nauuo is a girl who loves playing chess. One da ...

  5. Codeforces Round #564 (Div. 2) A. Nauuo and Votes

    链接:https://codeforces.com/contest/1173/problem/A 题意: Nauuo is a girl who loves writing comments. One ...

  6. Codeforces Round #564 (Div. 2)B

    B. Nauuo and Chess 题目链接:http://codeforces.com/contest/1173/problem/B 题目 Nauuo is a girl who loves pl ...

  7. Codeforces Round #564 (Div. 2)A

    A. Nauuo and Votes 题目链接:http://codeforces.com/contest/1173/problem/A 题目 Nauuo is a girl who loves wr ...

  8. Educational Codeforces Round 77 比赛总结

    比赛情况 我太菜了 A题 加减乘除不会 B题 二元一次方程不会 C题 gcd不会 就会一个D题二分答案大水题,本来想比赛最后一分钟来一个绝杀,结果 Wrong Answer on test 4 比赛总 ...

  9. Codeforces Round 564 题解

    很抱歉让标题把您骗进来了. 这是一场打得最失败的div1. 作为一个橙名一题都不会…… 旁边紫名的PB怒切3题,div2的也随便玩玩出了div1b/div2d…… 这名字颜色也太有水分了. 也就只会2 ...

随机推荐

  1. diverta 2019 Programming Contest

    A:签到. #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 ...

  2. C# DataContractJsonSerializer

    DataContractJsonSerializer dataSerializer = new DataContractJsonSerializer(request.getBizContentClas ...

  3. poj 2915

    #include <iostream> #include <algorithm> #include <cstdio> #include <cmath> ...

  4. jvm类加载原理和类加载器介绍

    虚拟机的类加载机制 在Class文件中描述的各种信息最终都需要加载到虚拟机中之后才能运行和使用.   虚拟机把描述类的数据从Class文件加载到内存,并对数据进行校验,转换解析和初始化,最终形成可以被 ...

  5. Creating a ModelForm without either the 'fields' attribute or the 'exclude' attribute is prohibited; form ResumeForm needs updating.

    django 报错 django.core.exceptions.ImproperlyConfigured: Creating a ModelForm without either the 'fiel ...

  6. Asp.Net Core 轻松学系列-2从安装环境开始

    Asp.Net Core 介绍     Asp.Net Core是微软新一代的跨平台开发框架,基于 C# 语言进行开发,该框架的推出,意味着微软从系统层面正式进击 Linux 服务器平台:从更新速度开 ...

  7. ipp 实现图像空间的转换

    下载:https://software.intel.com/en-us/parallel-studio-xe/choose-download/free-trial-cluster-windows-c- ...

  8. java注解日志记录到数据库

    1. pom添加依赖包 <!--添加aop依赖--><dependency> <groupId>org.springframework.boot</group ...

  9. Android开发之图像处理那点事——滤镜

    在Android开发中,一般对图像的处理就是Bitmap(位图),它包含了图像的全部数据,即点阵和颜色值,点阵就是包含像素点的矩阵,而颜色值就是ARGB,分别代表透明.红色.绿色.蓝色通道,它们共同决 ...

  10. 通过docker搭建ELK集群

    单机ELK,另外两台服务器分别有一个elasticsearch节点,这样形成一个3节点的ES集群. 可以先尝试单独搭建es集群或单机ELK https://www.cnblogs.com/lz0925 ...