链接:https://codeforces.com/contest/1169/problem/C 题意: Toad Zitz has an array of integers, each integer is between 00 and m−1m−1 inclusive. The integers are a1,a2,…,ana1,a2,…,an. In one operation Zitz can choose an integer kk and kk indices i1,i2,…,iki…
A - Circle Metro 模拟几百步就可以了. B - Pairs 爆搜一下,时间复杂度大概是 $O(4 * n)$ Code: 56306723 C - Increasing by Modulo 二分答案,然后验证一下就好了,第一个数越小越好,之后的数都要求和前一个相等或者大一点.复杂度 $n * log(n)$ D - Good Triple 对于每一个 $i$,需要计算出最小的 $x$,使得 $s[i-x] = s[x] = s[i + x]$,对于 $i$ 而言,如果区间左端点在…
一 题面 C2. Increasing Subsequence (hard version) 二 分析 需要思考清楚再写的一个题目,不能一看题目就上手,容易写错. 分以下几种情况: 1 左右两端数都小于等于构造的数组的最后一个数字 2 左右两端数至少有一个大于构造的数组最后一个数字 a. 左右两端数字相等,肯定满足上面条件.那么只可能走一个方向,两边都模拟一下,比一下大小即可 b. 左右两端数组不等,则优先看谁满足上面2的情况,若都满足则选最小的 三 AC代码 #include <bits/st…
链接:https://codeforces.com/contest/1169/problem/B 题意: Toad Ivan has mm pairs of integers, each integer is between 11 and nn, inclusive. The pairs are (a1,b1),(a2,b2),…,(am,bm)(a1,b1),(a2,b2),…,(am,bm). He asks you to check if there exist two integers …
链接:https://codeforces.com/contest/1169/problem/A 题意: The circle line of the Roflanpolis subway has nn stations. There are two parallel routes in the subway. The first one visits stations in order 1→2→…→n→1→2→…1→2→…→n→1→2→… (so the next stop after sta…
题意:给你一组数,每次可以选队首或队尾的数放入栈中,栈中元素必须保持严格单增,问栈中最多能有多少元素,并输出选择情况. 题解:首先考虑队首和队尾元素不相等的情况,如果两个数都大于栈顶元素,那么我们选小的放进去,否则选择比栈顶元素大的放进去,该题重点在于队首和队尾元素相同的情况,由于他们相同,那么我们如果将某一个数放进去后,因为栈中是严格单调的,那么假如我们选左边,那么右边就永远不可能再选了,同理选右边也是一样,所以我们在两边分别跑一下,求一个最长上升数组长度即可. 代码: int n; int…
D. Game with modulo 题目链接:https://codeforces.com/contest/1104/problem/D 题意: 这题是一个交互题,首先一开始会有一个数a,你最终的目的是要将它猜出来. 每次询问会输出"? x y",然后有: "x" (without quotes), if (x % a)≥(y % a). "y" (without quotes), if (x % a)<(y % a). 最多给你60次…
先二分一个区间,再在区间里面二分即可: 可以仔细想想,想明白很有意思的: #include<iostream> #include<cstdio> #include<algorithm> #include<cstdlib> #include<cstring> #include<string> #include<cmath> #include<map> #include<set> #include<…
Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/output 1 s, 256 MB  x2377 B Queue standard input/output 2 s, 256 MB  x1250 C Hacking Cypher standard input/output 1 s, 256 MB  x740 D Chocolate standard in…
A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给出的01序列相等(比较时如果长度不等各自用0补齐) 题解: 1.我的做法是用Trie数来存储,先将所有数用0补齐成长度为18位,然后就是Trie的操作了. 2.官方题解中更好的做法是,直接将每个数的十进制表示中的奇数改成1,偶数改成0,比如12345,然后把它看成二进制数10101,还原成十进制是2…