预处理后主席树维护 首先得出最后的答案为 \(\sum_{i=l}^{r}{min(right[i],r)-i+1}\) \(ri[i]\)表示i最远的上升序列(即代码中的f[i]) step1 那么首要问题就是如何求出\(right[i]\) 考虑当i--j-1是上升时使区间i--j是上升的 即sum[i-1]^sum[j-1]<=sum[i-1]^sum[j] 观察到两边有差异的是sum[j-1]和sum[j] 也就意味着sum[j-1]和sum[j]的不同会对i的取值有限制 假设k为二进制…
Forethought Future Cup - Elimination Round 窝也不知道这是个啥比赛QwQ A. Love "A" 给你一个串,你可以删去若干个元素,使得最后a的个数严格大于一半.求最大串长. #include<iostream> #include<cstdio> #include<cstring> using namespace std; char s[55];int v=0,n; int main() { scanf(&q…
CF1146 Forethought Future Cup Elimination Round Tutorial 叮,守夜冠军卡 https://codeforces.com/blog/entry/66639 B 有一个串\(s\),生成了一个新串\(t=s+s'\),\(s'\)是\(s\)去掉所有'a'之后的串,给出\(t\),求\(s\) 如果只看不是'a'的数量也只有最多一个位置满足条件,直接判一下这个位置即可. https://codeforces.com/contest/1146/s…
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) #include <bits/stdc++.h> using namespace std; int n,m,k; ; int main() { cin>>n>>m>>k; ;i<=k-;++i) { sum+=(n+(m-))*-(i)*; } cout<<sum<<endl;…
A - Forgetting Things 题意:给 \(a,b\) 两个数字的开头数字(1~9),求使得等式 \(a=b-1\) 成立的一组 \(a,b\) ,无解输出-1. 题解:很显然只有 \(a=b\) 和 \(a=b-1\) 的时候有解,再加上一个从 \(9\) 越到 \(10\) 的就可以了.被样例的 \(199,200\) 误导了. #include<bits/stdc++.h> using namespace std; typedef long long ll; int mai…
地址:http://codeforces.com/contest/872/problem/D 题目: D. Something with XOR Queries time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output This is an interactive problem. Jury has hidden a permutati…
https://odzkskevi.qnssl.com/f0fbdb108ec813b1294f8f714805963b?v=1502083692 网上搜到的题解: http://blog.csdn.net/zzkksunboy/article/details/76563303 xor的题,一般是考虑第一个不一样的位. 这个题当时考虑都是从字典树解决.这题可以对每个左边界找到最远的右边界,记作数组num[i]. 答案算两个部分,一个是num[i](l<=i<=r)小于等于r的,一个是num[i…
Description Santa Claus has Robot which lives on the infinite grid and can move along its lines. He can also, having a sequence of m points p1, p2, ..., pm with integer coordinates, do the following: denote its initial location by p0. First, the robo…
Description Santa Claus decided to disassemble his keyboard to clean it. After he returned all the keys back, he suddenly realized that some pairs of keys took each other's place! That is, Santa suspects that each key is either on its place, or on th…
Description Santa Claus is the first who came to the Christmas Olympiad, and he is going to be the first to take his place at a desk! In the classroom there are n lanes of m desks each, and there are two working places at each of the desks. The lanes…