Educational Codeforces Round 66 差G】的更多相关文章

Educational Codeforces Round 66 F 题意:长度为 n 的序列,求有多少个区间 \([l,r]\) ,使得其构成了一个 1~r-l+1 的排列. \(n \le 3*10^5, a_i \le n\) key:随机权值 合法区间中肯定包含 1 ,并且最大值就是长度.先考虑最大值在 1 的右边的情况,可以枚举每个 1 的右边,记录最大值 x ,此时需要检查 \([r-x+1,r]\) 这个区间是否是一个排列.最大值在 1 左边的情况同理. 考虑 hash :给 1~n…
Educational Codeforces Round 68 E 题意:有 n 个线段,每个都是平行 x 或者 y 轴,只有互相垂直的两线段才会相交.问形成了多少个矩形. \(n \le 5000, -5000 \le x_i,y_i \le 5000\) key:树状数组 考虑枚举矩形上边和下边,如果统计出与这两条边相交的竖线个数,那么就能知道贡献.先枚举下边,把所有与它相交的竖线插入树状数组.如果把竖线按照上端点的纵坐标排序,那么按照从下往上枚举上边时就可以删掉某些竖边.总复杂度 \(O(…
链接:https://codeforces.com/contest/1175/problem/B 题意: You are given a function ff written in some basic language. The function accepts an integer value, which is immediately written into some variable xx. xx is an integer variable and can be assigned…
链接:https://codeforces.com/contest/1175/problem/A 题意: You are given an integer nn and an integer kk. In one step you can do one of the following moves: decrease nn by 11; divide nn by kk if nn is divisible by kk. For example, if n=27n=27 and k=3k=3 yo…
A. From Hero to Zero 题目链接:http://codeforces.com/contest/1175/problem/A 题目 ou are given an integer n and an integer kIn one step you can do one of the following moves:decrease n by 1;divide n by k if n is divisible by k.For example, if n=27 and k=3 yo…
A.直接模拟. #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #define rep(i,l,r) for (int i=(l); i<=(r); i++) typedef long long ll; using namespace std; ll n,k,T,ans; int main(){ for (cin>>T; T--; ){ ci…
Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 <= n <= 200000\), 如果至多删除其中的一个数之后该序列为严格上升序列,那么称原序列为几乎严格上升序列. 现在每次将序列中的任意数字变成任意数字,问最少要操作几次才能将序列变成几乎严格上升子序列. 思路: 如果不考虑删除,求让整个序列都变成严格上升子序列的次数 求出\(序列a_i - i\)…
Educational Codeforces Round 63 A 题目大意就不写了. 挺简单的,若果字符本来就单调不降,那么就不需要修改 否则找到第一次下降的位置和前面的换就好了. #include<iostream> #include<cstdio> #include<cctype> #include<algorithm> #include<queue> using namespace std; const int N = 3e5 + 3;…
UPD:变色了!!!历史最高1618~ Educational Codeforces Round 81 (Rated for Div. 2) The 2019 University of Jordan Collegiate Programming Contest   充实的一天,打两场可还行.补的一些题记录一下. edu81 Educational Codeforces Round 81 (Rated for Div. 2) 还不知道上分还是掉分,还挺可惜的,被B卡了没做出来,C也调了一会儿答案…
Educational Codeforces Round 20  A. Maximal Binary Matrix 直接从上到下从左到右填,注意只剩一个要填的位置的情况 view code //#pragma GCC optimize("O3") //#pragma comment(linker, "/STACK:1024000000,1024000000") #include<bits/stdc++.h> using namespace std; fu…