文章分类 - CF题目合集
摘要://URL: https://www.luogu.com.cn/problem/CF1837F /* 6 5 4 1 10 1 1 1 5 3 1 20 5 15 3 5 3 1 20 3 15 5 10 6 10 8 20 14 3 8 6 4 16 11 10 5 9 9 2 13 15 19
阅读全文
posted @ 2023-10-24 05:07
JMXZ
摘要:/* 3 2 3 1 0 1 3 1 2 3 2 2 1 3 0 2 1 5 3 1 2 5 4 5 1 3 3 2 3 1 4 3 3 2 1 2 1 2 */ /* 通过置换环 知道 答案是 所有 pi<i 的数 所以统计一下就可以了 O(N^2) 每一个数 对 每次询问的答案 的贡献 是一个区
阅读全文
posted @ 2023-10-22 09:50
JMXZ
摘要:// LUOGU_RID: 129858861 /* A+b[b-1]>c[c]-1 A+b[b]-1<c[c-1] c[c-1]~~~~~~~~~~~ c[c]-1 A+b[b-1] A+b[b]-1 */ #include<cstdio> #include<iostream> #include<
阅读全文
posted @ 2023-10-22 09:04
JMXZ
摘要:// LUOGU_RID: 129683316 /* 6 3 1 2 3 5 1 2 3 4 5 2 2 3 1 1000000000 12 1 8 4 2 3 5 7 2 9 10 11 13 12 7 2 5 4 2 1 1 2 3 11 8 9 4 7 1 1 16 13 */ /* #inc
阅读全文
posted @ 2023-10-22 09:03
JMXZ
摘要:/* 7 5 abcde abxde 5 hello olleo 2 ab cd 7 aaaaaaa abbbbba 1 q q 6 yoyoyo oyoyoy 8 abcdefgh hguedfbh 1 2 3 9 0 2 6 */ #include<cstdio> #include<iostre
阅读全文
posted @ 2023-10-22 09:02
JMXZ
摘要:/* 题意: 将序列 交换排序成 逆序对 为 1 的排序 1.pre:置换环 pi -> a[pi] 最后会连成一个首尾相接的 环 答案是 n-cur 2.若 pi+1 / pi-1 已经在了 逆序对 ==1 ->flag flag==0 Ans=n-cur+1 flag==1 Ans=n-cur-
阅读全文
posted @ 2023-10-22 08:59
JMXZ
摘要:/* 5 3 3 100 2 1 14 91 2 13 36 16 6 73 8 22 100 0 26 72 176 */ /* */ #include<cstdio> #include<iostream> #include<algorithm> #include<cmath> #include<
阅读全文
posted @ 2023-10-22 08:37
JMXZ
摘要:/* 极差是 两个数的最大值 1.>>>>> <><><><> <<<<<< / <<<<<<< <><><><><> >>>>>> 2*(max(L1,L2)-com_lenth) 2.>>>> <><><> >>>>>> 2*|L1-L2| 3.&
阅读全文
posted @ 2023-10-05 16:19
JMXZ
摘要:/* n个数 1/-1 求最少修改几个数 满足 ai..>=0 且 ai*..==1 n/=2 是 -1 最多的个数 cnt(-1个数) 修改后一定是偶数 1.cnt偶数+cnt<=n/2 -> 0 2.cnt偶数+cnt>n/2 ->cnt-n/2+(cnt-n/2 %2 ==1)*1 3.cnt
阅读全文
posted @ 2023-10-05 00:28
JMXZ
摘要:/* :::给定 L<=R 求最大的 |ai-bi|+.... 100位 一定是贪心 否则数组 炸裂 观察 样例就可以发现 构造答案 1.n!=m 补成m 前缀照抄 string/char -> reverse string->push_back() 2.首位不变 |A0000000-B999999
阅读全文
posted @ 2023-10-04 23:55
JMXZ
摘要:/* 最小值最大-> 二分 -> 右偏 r=mid-1 l<r 首先考虑最简单情况 sort(a) k<=n 则倒叙 加上 ai 若人不符合 return0 k>n >>因为1~k 所以连续两次操作 -1 >>ai'=ai+p1-p2+p3-p4....(-1)^(t-1)pt 操作奇数次 一定增
阅读全文
posted @ 2023-10-03 09:32
JMXZ
摘要:/* */ #include<cstdio> #include<iostream> #include<algorithm> #include<cmath> //#include<queue> //#include<vector> //#include<bits/stdc++.h> #define l
阅读全文
posted @ 2023-09-29 11:50
JMXZ
摘要::::char/strinf 0-1-2-3..... #include<cstdio> #include<iostream> #include<algorithm> #include<map> //#include<queue> //#include<vector> //#include<bits
阅读全文
posted @ 2023-08-26 18:16
JMXZ
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<map> //#include<queue> //#include<vector> //#include<bits/stdc++.h> #define ll long l
阅读全文
posted @ 2023-08-26 11:41
JMXZ
摘要://< -> <= #include<cstdio> #include<iostream> #include<algorithm> #include<queue> #include<ctime> #include<cmath> #include<bits/stdc++.h> #define ll l
阅读全文
posted @ 2023-08-19 11:13
JMXZ
摘要:#include<cstdio> #include<iostream> #include<algorithm> #include<queue> #include<ctime> #include<cmath> #include<bits/stdc++.h> using namespace std; c
阅读全文
posted @ 2023-08-19 10:36
JMXZ
摘要://find->fa[i]=i //因为有环 所以 双向边标记之访问一次 //fa[find()]=find() 没关系 但siz+=.....有问题 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm>
阅读全文
posted @ 2023-08-18 10:42
JMXZ
摘要:状态压缩dp :::& 结果<=64 :::有mod 不用 long long %mod 过程量用1ll* :::i>>0~7 #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<bit
阅读全文
posted @ 2023-08-17 14:05
JMXZ
摘要:#include<bits/stdc++.h> using namespace std; int t,n,p[2010]; int main(){ scanf("%d",&t); while(t--){ scanf("%d",&n); int l=0,r=0; for(int i=1;i<=n;i+
阅读全文
posted @ 2023-08-15 01:15
JMXZ
摘要::::easy->easy #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<bits/stdc++.h> #define ll long long #define ddd print
阅读全文
posted @ 2023-08-13 13:23
JMXZ