LeetCode笔记:Biweekly Contest 55 1. 题目一 1. 解题思路2. 代码实现 2. 题目二 1. 解题思路2. 代码实现 3. 题目三 1. 解题思路2. 代码实现 4. 题目四 1. 解题思路2. 代码实现 1. 题目一 给出题目一的试题链接如下: 1909. Remove One Element to Make the Array Strictly I
D. Fragmentation merging D. Fragmentation merging 题意:自己看 题解:对每一种情况进行判断,看是不是由最多两段组成就行了 AC代码 #include "bits/stdc++.h" using namespace std; #define ll long long const int maxn=5e3+10; const int inf=0x3f3f3f3f; inline int rd(){
2020-2021 “Orz Panda” Cup Programming Contest A. Accordion Artist And Orz Pandas 题意 给定\(n\)个相邻的矩形,矩形的宽和高给定,问最大的子矩形面积 分析 单调栈板题,维护出每个矩形左边第一个比他低的点和右边第一个比它低的点,两点距离就是宽,高就是当前矩形的高,维护宽X高的
Atcoder 题面传送门 & 洛谷题面传送门 震惊,我竟然能独立切掉 AGC E 难度的思维题! hb:nb tea 一道 感觉此题就是找性质,找性质,再找性质( 首先看到排列有关的问题,我们可以很自然地将排列拆成一个个置换环,即我们建一张图 \(G\),对于 \(i\in[1,n]\) 连边 \(i\to p_i\),那么题目的要求就可以
E. Even Degree Problem - E - Codeforces 找出欧拉图的欧拉回路,并将路径都存入数组中,计第一位l=1最后一位r=top(top为改欧拉图的边数) 找欧拉回路的操作: 从任意一点开始dfs,dfs的途中删除已经遍历过的边减小搜索规模,具体操作每次便利前向星的时候不让i直接等于e[i].next而是
HZNU-AlternatingCat 训练实录 现场赛记录:[名称:奖项/排名] 2021: The 2021 ICPC China Shaanxi National Invitational Programming Contest : Silver/83 To do list: 暑假每周坚持五训,尽量在当天和第二天补完题 学习金牌难度算法,不要畏难 多校认真打,当成正式比赛 我加强数学(以
https://leetcode-cn.com/contest/weekly-contest-102/problems/sort-array-by-parity/ 水题 我的解决方案: class Solution { public int[] sortArrayByParity(int[] A) { int[] B = new int[A.length]; int cnt=0; for(int i=0;i<A.length;i++) {
COCI2015/2016 Contest#4 D 题意: 给出一个有 \(n\) 个节点的 \(k\) 叉树. \(k\) 叉树是指每个点最多有 \(k\) 个儿子的树(每一条边权值为1).每个节点的编号就是该节点加入树的顺序,每个节点从左往右添加到树中,节点 \(x\) 的深度增加当且仅当在它左边的每个节点都已经被填满了
AtCoder Beginner Contest 165 問題の不備が発見されたため、10分間開始を遅らせます。申し訳ありません。 / The start will be delayed for 10 minutes due to an inadequacy discovered in the problem. I'm sorry.
Keeping Rabbits DreamGrid is the keeper of n rabbits. Initially, the i-th (1≤i≤n) rabbit has a weight of wi. Every morning, DreamGrid gives the rabbits a carrot of weight 1 and the rabbits fight for the only carrot. Only one rabbit wins the fight and ea
Justifying the Conjecture time limit per test1 second memory limit per test512 megabytes inputstandard input outputstandard output The great mathematician DreamGrid proposes a conjecture, which states that: Every positive integer can be expressed as the
比较模板的题。 题目 给定一个字符串 \(S\),\(n\) 个字符串 \(T_1,T_2,\dots,T_n\),每个串长度都是 \(m\),一个长度为 \(k\) 的有理数序列 \(p_1,p_2,\dots,p_k\) 保证 \(\sum p_i=1\)。每个字符串由前 \(k\) 个小写字母构成。 我们进行下面的过程: 如果存在 \(j(1\le j\le n)\) 满足
LeetCode笔记:Weekly Contest 243 LeetCode笔记:Weekly Contest 243 1. 题目一 1. 解题思路2. 代码实现 2. 题目二 1. 解题思路2. 代码实现 3. 题目三 1. 解题思路2. 代码实现 4. 题目四 1. 解题思路2. 代码实现 1. 题目一 给出题目一的试题链接如下: 1880. Check if Word Equ
C.Odd Even Sort 题目描述 点此看题 有一个长度为 \(n\) 的排列,要求通过 \(n^2\) 次操作把他变成 \(1,2...n\) 的排列: 奇数次操作可以操作奇数位置 \(x\),即交换 \(p[x],p[x+1]\) 偶数次操作可以操作偶数位置 \(x\),即交换 \(p[x],p[x+1]\) \(n\leq 500\) 解法 \(n^2\) 次操作这么
题目链接: Leetcode Weekly Contest 243 写在前面: 本次周赛做出了前两题。 1、1880. Check if Word Equals Summation of Two Words 难度:Easy 题目大意: 将字符串按照题意规则转化成相应的值。 思路: 模拟即可 。 代码 class Solution { public boolean isSumEqual(String f
题意:有一颗树,根结点为\(1\).\(q\)个询问,每次问你共有多少经过\(u\)点且到根节点距离为\(d\)的点. 题解:这题技巧性好强,我们从根节点遍历整颗树,用时间轴记录搜到和离开的时间\(in_i\)和\(out_i\),同时存入同一深度的所有\(in_i\),方便后面计算.对于某个父亲结点\(u\),它
Blow up the Enemy #include <bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define T ll t ;scanf("%lld",&t);while(t--) using namespace std ; typedef long long ll; typedef unsigned long long ull; const ll maxn=1e5+10;
题目链接 Problem Statement Among the strings of length A+B containing A occurrences of a and B occurrences of b, find the string that comes K-th in the lexicographical order. Sample Input 1 2 2 4 Sample Output 1 baab Sample Input 2 30 30 11826458156486
原题 Gym 101243B It has become a good tradition to solve the “Hanoi tower” puzzle at programming contests in Rybinsk. We will review the rules briefly. There are 3 rods marked A, B, C. Initially, N disks of different diameter are placed on rod A: the smalle
https://codeforces.com/problemset/problem/1257/E 思路:lis二分板子 #include<iostream> #include<vector> #include<queue> #include<cstring> #include<cmath> #include<map> #include<set> #include<cstdio> #include<alg
AtCoder Grand Contest 017 2020年了。 时隔2年半,在时间长河的下游,凝视着,最开始的篇章。 AtCoder说,我的Performance是1700。 于是,我的Rating从17涨到了493。 那是无忧无虑的日子,基本每周有比赛,我一定参加。 在家里,在外地。在书桌前,在火车上。用电脑,用iPad。 从最开始的Python 2,逐
A - Tasks dp或者贪心 #define x first #define y second #define pb push_back #define ls rt << 1 #define rs rt << 1 | 1 typedef long long ll ; const double esp = 1e-6 , pi = acos(-1) ; typedef pair<int , int> PII ; const int N = 1e6 + 10 , INF
反馈邮件: Guideline 5.3.2 - Legal - Gaming, Gambling, and Lotteries Your app includes a contest or sweepstakes but it does not: - Indicate that Apple is not involved in any way with the contest or sweepstakes. Next Steps It is necessary to: - Include o
While we enjoy chatting with friends on the internet, it is always annoying that we are overwhelmed by lots of messages in various chat groups. A great majority of these messages are actually not interesting to us, but we may miss some important notices i
传送门:link D Determinant 给定 \(n\) 个点 \(m\) 条边的简单连通无向图,求邻接矩阵行列式\(\bmod 998244353\)。 \(n\le 2.5\cdot 10^4\),\(m\le 5\cdot 10^5\),\(\exist k\in\{1,2,\cdots,25\}\),\(\forall A\subseteq V\land |A|=k+1\),\(\exist a,b\in A\),\(e\in