codeforces contest round https
AtCoder Regular Contest 123 F Insert Addition
洛谷传送门 AtCoder 传送门 用 \((x, y)\) 表示 \(Ax + By\),那么这个等价于 SB 树。 那么直接在 SB 树上二分,遍历一遍找到 \(n\) 个点就好了。可以采用类似线段树查询的方式。 于是现在还剩下一个子问题:给定 \(a, b\),求 \(ax + by \le ......
Problem - 616C - Codeforces
Problem - 616C - Codeforces C. The Labyrinth 如果是直接对\(*\)去跑dfs或者bfs的话无疑是会超时的 既然如此,那我们可以去对 \(.\) 跑搜索,将各个连通的 \(.\) 块标号并计算出连通块内的点的数量,然后去遍历\(*\)的时候只需要上下左右跑 ......
2022 China Collegiate Programming Contest (CCPC) Mianyang Onsite GCHMAD
2022 China Collegiate Programming Contest (CCPC) Mianyang Onsite 目录2022 China Collegiate Programming Contest (CCPC) Mianyang OnsiteVP 情况G - Let Them E ......
P8512 [Ynoi Easy Round 2021] TEST_152
题外话 纪念一下第一道 Ynoi Easy Round.(上次那个是 Ynoi 模拟赛,什么时候才能做正统 Ynoi 啊/ll 在图老师的逼迫下换了洛谷博客的主题和背景,还挺好看的感觉。 原题传送门 题意 给定一个长度为 \(m\) 的序列,初始全为 \(0\)。再给 \(n\) 个区间赋值操作。 ......
Codeforces Round 900 (Div. 3)
Codeforces Round 900 (Div. 3) A. How Much Does Daytona Cost? 解题思路: 可取一个元素作为子数组,数组中存在\(k\)即可。 代码: #include<bits/stdc++.h> using namespace std; using ll ......
The 2021 China Collegiate Programming Contest (Harbin) JBEIDG
The 2021 China Collegiate Programming Contest (Harbin) 目录The 2021 China Collegiate Programming Contest (Harbin)VP概况J - Local MinimumB - Magical Subseq ......
CF1195 Codeforces Round 574 (Div. 2)
CF1195A Drinks Choosing 先将相同权值的配对直到只剩下一个,然后再配剩下的单个。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int n,k; int a[N]; int ......
CF1440 Codeforces Round 684 (Div. 2)
CF1440A Buy the String 每个点有两种决策,要么选当前的字符,要么选跟当前字符不同的字符,取个较小值相加。 #include<iostream> #include<cstdio> using namespace std; const int N=1005; int T; int ......
CF1197 Educational Codeforces Round 69 (Rated for Div. 2)
CF1197A DIY Wooden Ladder 答案为 \(\min(a_{n-1},n-2)\)。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=100005; ......
CF1447 Codeforces Round 683 (Div. 2, by Meet IT)
CF1447A Add Candies 可以将操作看做将 \(a_i\) 减 \(i\),然后第 \(i\) 次操作 \(i\) 就是合法的。 #include<iostream> #include<cstdio> using namespace std; int T; int n; void so ......
Gym 104172 The 2023 ICPC Asia Hong Kong Regional Programming Contest (The 1st Universal Cup, Stage 2Hong Kong)
A. TreeScript 令 \(f_u\) 表示 \(u\) 及 \(u\) 子树中的节点都创建的最小数量。 如果 \(u\) 只有一个儿子,那么可以将子树最后一个节点存储在当前的 \(u\) 中,答案就是 \(f_v\)。 若 \(u\) 有多个儿子: 令 \(t=\max\limits_{v ......
CF1008 Codeforces Round 497 (Div. 2)
CF1008A Romaji 直接模拟。 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=105; int n; char s[N]; int main() { scanf( ......
CF1011 Codeforces Round 499 (Div. 2)
CF1011A Stages 每次记下上一个选的位置,贪心能填就填。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n,k; char s[N]; int cnt[27]; int main( ......
CF1072 Codeforces Round 517 (Div. 2, based on Technocup 2019 Elimination Round 2)
CF1072A Golden Plate 第 \(i\) 个矩形的周长为 \(2(w - 4(i - 1))+2(h - 4(i - 1))-4\),枚举 \(i\) 求和。 #include<iostream> #include<cstdio> using namespace std; int n ......
CF1079 Codeforces Round 522 (Div. 2, based on Technocup 2019 Elimination Round 3)
CF1079A Kitchen Utensils 令 \(c_i\) 表示餐具 \(i\) 出现的数量,最小的餐具套数为 \(t=\lceil \frac{\max\{c_i\}}{k}\rceil\),按照这个计算就好了。 #include<iostream> #include<cstdio> # ......
CF1020 Codeforces Round 503 (by SIS, Div. 2)
CF1020A New Building for SIS 分类讨论 \(a,b\) 两个端点的几种情况就好了,特判 \(t_a=t_b\) 的情况。 #include<iostream> #include<cstdio> #include<cmath> #include<algorithm> usi ......
CF1162 Codeforces Round 557 (Div. 2) [based on Forethought Future Cup - Final Round]
CF1162A Zoning Restrictions Again 每个位置越高越好,暴力模拟即可。 #include<iostream> #include<cstdio> using namespace std; const int N=55; int n,h,m; int a[N]; int m ......
CF1036 Educational Codeforces Round 50 (Rated for Div. 2)
CF1036A Function Height 答案为 \(\lceil \frac{k}{n}\rceil\)。 #include<iostream> #include<cstdio> using namespace std; long long n,k; int main() { scanf(" ......
CF957 Codeforces Round 472 (rated, Div. 2, based on VK Cup 2018 Round 2)
CF957A Tritonic Iridescence 如果原序列中有两个相同的字符,显然不合法。 如果开头或者结尾为 ?,或者有两个连续的 ?,或者一个 ? 两边的字符不同显然合法。 否则一定不合法。 #include<iostream> #include<cstdio> using namesp ......
CF992 Codeforces Round 489 (Div. 2)
CF992A Nastya and an Array 答案为非零数的个数。 #include<iostream> #include<cstdio> #include<map> using namespace std; const int N=100005; int n; int a[N]; map< ......
CF996 Codeforces Round 492 (Div. 2) [Thanks, uDebug!]
CF996A Hit the Lottery 直接贪心尽可能的分配到 \(k_5\),剩下的依次分配给 \(k_4,k_3,k_2,k_1\)。 #include<iostream> #include<cstdio> using namespace std; int n; int k[6]; int ......
Codeforces Round 900 (Div. 3) - A B C D E
目录A. How Much Does Daytona Cost?B. Aleksa and Stack A. How Much Does Daytona Cost? 判断数 k 包不包含在数组里面即可 B. Aleksa and Stack 选定初始数为2, 3,后面的遍历 法二:全奇数即可,因为奇 ......
AtCoder Regular Contest 127 F ±AB
洛谷传送门 AtCoder 传送门 非常妙的题。 先直观感受一下,显然当 \(M\) 大到一定程度后,\([0, M]\) 的所有数都能被取到。考虑 \(V \gets V + Ax + By\),其中 \(V + Ax + By \in [0, M]\)。如果 \(x, y\) 都是正数显然可以取 ......
KEYENCE Programming Contest 2019
A - Beginning 排序以后判断一下是否为 \(1,4,7,9\) 即可。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=10; int a[N]; int m ......
NIKKEI Programming Contest 2019
A - Subscribers 最小值为 \(\min(A,B)\),最大值为 \(\max(A+B-n,0)\)。 #include<iostream> #include<cstdio> using namespace std; int n,A,B; int main() { scanf("%d% ......
[题解] Codeforces Round 900(Div.3) E~F
Codeforces Round 900(Div.3) E~F E. Iva & Pav 因为按位与的结果不会随着越多数字的增加而增加,因此我们可以利用这个性质二分出右端点,只需要一个可以查询区间的数据结构即可。 或者是按位考虑第 \(i\) 个数字的第 \(k\) 位,后缀最近的 \(0\) 的位 ......
2023.9.27 LGJ Round
A 已知一个字符串 \(n\le 1e3\) 中的若干信息,:\((x,y,z)\) 表示 \(x\) 后缀和 \(y\) 后缀的 \(\text{LCP}=z\). 求满足条件的字典序最小的字符串。 已知 \(a_{x+i}=a_{y+i}(i<z)\),考虑维护并查集,一定相同的在一个集合。 然 ......
Yahoo Programming Contest 2019
A - Anti-Adjacency 合法的条件即为 \(k\leq \lceil \frac{n}{2} \rceil\)。 #include<iostream> #include<cstdio> using namespace std; int n,k; int main() { scanf(" ......
Tenka1 Programmer Contest 2019
C - Stones 枚举分界点爆算即可。 #include<iostream> #include<cstdio> using namespace std; const int N=200005; int n; char s[N]; int sum[N][2]; int main() { scanf ......
Social Infrastructure Information Systems Division, Hitachi Programming Contest 2020
A - Hitachi String 满足条件的串即为串长为偶数且相邻两个均为为 hi,直接判断即可。 代码: #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=15; int ......