[cf 1236 E] Alice and the Unfair Game】的更多相关文章

题意: 给定一个长度为m的序列$A$,你有一个长度为n的棋盘,可以任选一个位置x作为起点. 在时刻$[1,m+1]$你可以向左或向右移动一格. 设时刻i你移动后所在的位置为$B_i$,你需要满足对于任意$1\leq i\leq m$,$A_{i}\neq B_{i}$. 求有多少对有序数对$(x,y)$,使得以x为起点且以y为终点的合法移动路径存在. $n,m\leq 10^{5},1\leq A_{i}\leq n$. 题解: 首先观察出一个性质:设x向左最远走到l,向右最远走到r,则$[l,…
题:https://codeforces.com/contest/1236/problem/E 粗自:https://www.cnblogs.com/YSFAC/p/11715522.html #include<bits/stdc++.h> using namespace std; #define lson root<<1,l,midd #define rson root<<1|1,midd+1,r typedef long long ll; ; ll a[M],tre…
传送门 首先可以注意到对于固定的起点 $S$ ,它最终能走到的终点一定是一段区间 这个用反证法容易证明,假设合法区间存在断点,这个点左右都可以作为终点 那么分成区间断点在起点左边和起点右边讨论一下即可,起点本身显然一定可以作为终点 然后现在只要考虑从每个起点出发能走到的最左和最右的位置即可算出答案 首先考虑往右(以下为了方便把第 $i$ 次询问说成第 $i$ 天) 设起点为 $x$ 那么我们可以一直往右走直到遇到某一天刚好询问原本要走的下一个位置,那么此时就要停一次 设连续走了 $y$ 天遇到这…
传送门 A. Stones 签到. B. Alice and the List of Presents 单独考虑每个数的贡献即可. 答案为\((2^{m}-1)^n\). C. Labs 构造就类似于: 1 6 7 2 5 8 3 4 9 这样就行了. 证明我也不会,但感觉这样能使得每一行都较为均衡. Code #include <bits/stdc++.h> #define MP make_pair #define fi first #define se second #define sz(…
http://codeforces.com/contest/347/problem/C 这道题就是求出n个数的最大公约数,求出n个数的最大值,总共有max1/gcd-n个回合.然后判断如果回合数%2==0 输出Bob,否则输出Alice. #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int main() { ; int n; int m; while(sca…
Alice and Bob decided to eat some fruit. In the kitchen they found a large bag of oranges and apples. Alice immediately took an orange for herself, Bob took an apple. To make the process of sharing the remaining fruit more fun, the friends decided to…
CF6C Alice, Bob and Chocolate 题目链接 写了一天搜索写的有点累了,就顺手水了一道CF的模拟题 这道题就是简单的模拟整个题的过程,注意最后输出的形式就好了QWQ AC代码如下: #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #define MAXN 500000 using namesp…
// 比赛链接:https://codeforces.com/contest/1196 // CF 2019.7.24 // 本想Div3手速场上分,结果卡在C题,掉了不少分. // 自闭了这么久,今天补题,吸取教训. A - Three Piles of Candies 题意: 比赛时候看了半天也没看明白,真是sb了. Alice与Bob要把三堆糖果尽可能地平分,两人轮流拿,最后一个拿的要保证两人一样多.否则的话如果最后谁多了就要扔掉,直到两人拿的糖果数量相等. 给定三堆糖果初始数量,求他们能…
https://codeforces.com/contest/1236/problem/B Alice got many presents these days. So she decided to pack them into boxes and send them to her friends. There are nn kinds of presents. Presents of one kind are identical (i.e. there is no way to disting…
由于一次比赛被虐得太惨,,生发开始写blog的想法,于是便有了这篇随笔(找了个近期的cf比赛练练手(bushi))第一次写blog,多多包涵. 第二场cf比赛,第一场打的Div2,被虐太惨,所以第二场挑了个Div4... 比赛链接: https://codeforces.com/contest/1669 A. Division 翻译(参考): t组样例,每组样例给出一个正整数,判断该整数所在的范围 题解: 签到题,分类讨论下即可 B.Trip 翻译(参考): t组样例,每组给出一个长度为n的数组…