题意 给你一个长为 \(n\) 的序列 \(a_i\) 需要支持四个操作. \(1~l~r~x:\) 把 \(i \in [l, r]\) 的 \(a_i\) 加 \(x\) . \(2~l~r~x:\) 把 \(i \in [l, r]\) 的 \(a_i\) 赋值成 \(x\) . \(3~l~r~x:\) 求 \([l, r]\) 区间的第 \(x\) 小元素. \(4~l~r~x~y:\) 求 \((\sum_{i = l}^{r} {a_i}^x) \mod y\) . 一共会操作 \…
B. Chtholly's request time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output — Thanks a lot for today. — I experienced so many great things. — You gave me memories like dreams... But I have to le…
Codeforces Round #449 (Div. 2) https://codeforces.com/contest/897 A #include<bits/stdc++.h> using namespace std; #define lson l,mid,rt<<1 #define rson mid+1,r,rt<<1|1 #define sqr(x) ((x)*(x)) #define pb push_back #define eb emplace_back…
ODT(主要特征就是推平一段区间) 其实就是用set来维护三元组,因为数据随机所以可以证明复杂度不超过O(NlogN),其他的都是暴力维护 主要操作是split,把区间分成两个,用lowerbound, 有两点需要注意1.set里的东西不能改,所以变成了mutable(可改的const),2.s.insert返回pair类型,first是插入点的迭代器 = =sort里的比较函数ll没开wa了好久 精简版: //#pragma comment(linker, "/stack:200000000&…
A. Scarborough Fair time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Are you going to Scarborough Fair? Parsley, sage, rosemary and thyme. Remember me to one who lives there. He once was th…
题目链接 交互题. 题意:给你三个数n,m,k.让你完成至多m次互动,每次给你一个q,让你从n个位置选一个位置放这个数,覆盖已经放过的数.让你再m次使得n个位置的数不递减,达到直接退出. 解法:暴力,如果q小于c/2的话,从前往后找,若当前位置没有数或者比q大的话,就直接放再这个位置上,大于c/2的话就从后往前找,若当前位置没有数或者比q小的话就直接放. 如果每个位置都有数的话说明放完了. #include<bits/stdc++.h> #define LL long long #define…
又掉分了0 0. A. Scarborough Fair time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Are you going to Scarborough Fair? Parsley, sage, rosemary and thyme. Remember me to one who lives there. He on…
A. Scarborough Fair time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Are you going to Scarborough Fair? Parsley, sage, rosemary and thyme. Remember me to one who lives there. He once was th…
A. Scarborough Fair 题意 对给定的长度为\(n\)的字符串进行\(m\)次操作,每次将一段区间内的某一个字符替换成另一个字符. 思路 直接模拟 Code #include <bits/stdc++.h> using namespace std; typedef long long LL; int main() { int n, m, s,t ; char c1, c2; char ss[110]; scanf("%d%d", &n, &m…
B:注意到nc/2<=m,于是以c/2为界决定数放在左边还是右边,保证序列满足性质的前提下替换掉一个数使得其更靠近边界即可. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long #de…