atcoder digit 060d arc

Solution -「ARC 106E」Medals

Desc. Link. 你有 \(n\) 个朋友,他们会来你家玩,第 \(i\) 个人 \(1...A_i\) 天来玩,然后 \(A_i+1...2A_i\) 天不来,然后 \(2A_i+1...3A_i\) 又会来,以此类推; 每天你会选一个来玩的人,给他颁个奖,如果没人来玩,你就不颁奖。 你要给 ......
Solution Medals 106E ARC 106

[ARC150D] Removing Gacha 题解

题意 给定一棵由 \(N\) 个节点组成的树,每个节点有黑白两种颜色。定义一个节点 \(u\) 为好的当且仅当路径 \(1 \leftrightarrow u\) 上的节点均为黑色的,反之为坏的。初始情况下所有点均为白色。 定义一次操作为选取一个坏的节点并将其染黑,求将全部节点均染为黑色的期望操作次 ......
题解 Removing Gacha 150D ARC

AtCoder Grand Contest 036 F Square Constraints

洛谷传送门 AtCoder 传送门 本质是 \(p_i \in [l_i, r_i]\) 的计数问题。 当 \(1 \le i \le n\) 时,\(l_i\) 才可能不等于 \(1\)。考虑容斥,设钦定 \(m\) 个不满足条件(上界为 \(l_i - 1\)),其余任意(上界为 \(r_i\) ......
Constraints AtCoder Contest Square Grand

AtCoder Beginner Contest 288 Ex A Nameless Counting Problem

洛谷传送门 AtCoder 传送门 考虑到规定单调不降比较难搞。先设 \(g_t\) 为长度为 \(t\) 的满足条件的序列个数(可重且有顺序)。求这个可以设个 dp,\(f_{d, i}\) 表示考虑到从高到低第 \(d\) 位,当前 \(t\) 个数中有 \(i\) 个仍然顶上界,并且之前的位都 ......
Beginner Counting Nameless AtCoder Contest

几道 ARC 的题目

写在前面的话 我从今年 \(7\) 月末开始断断续续地写 ARC 的题目,\(9\) 月中旬的时候已经做了少量的题了,还有许多 F 没写,一方面是因为我水平太差看不懂题解,另一方面是因为一种题写多了总是有一种无聊的感觉的。所以到此为止吧,把这些日子水的题放在这篇博客中吧,以后再写 ARC 的题大概会 ......
题目 ARC

[ARC035B] アットコーダー王国のコンテスト事情 题解

前置芝士 排列组合 分析 明显的贪心,第一问与此题思路相似,优先选择做时间少的,可以尽可能让后面的罚时尽量的小。 难点在第二问,第二问问的是有几种可能性,有个显然的结论: 相同做题时间的题目,位置调换答案仍然相同。 那么可以用 桶+排列组合 来解决: 用桶储存这个做题时间的出现次数 \(b_i\), ......
题解 事情 035B ARC 035

错误解决Error: error:0308010C:digital envelope routines::unsupported

问题原因:查了下原因,主要是 nodeJs V17 版本发布了 OpenSSL3.0 对算法和秘钥大小增加了更为严格的限制,nodeJs v17 之前版本没影响,但 V17 和之后版本会出现这个错误。 我的node版本是v18.12.1解决方式(仅 windows):在 package.json 的 ......

Atcoder abl c

传送门 题目描述 有n个城市,m条双向路的图,问你最少添加几条路使得任意两个城市可以两两到达? 样例 样例输入 3 1 1 2 样例输出: 1 题目解析 这是个双向路的图,我们可以把它当成一个非连通图。在各个点之间有连线,要求我们算出如何能将整个图的各个部分连接起来。那么,我们只要算出这个非连通图由 ......
Atcoder abl

[ARC136C] Circular Addition

题目大意 给定一个长度为 \(N\) 的序列 \(A\),这个序列组成一个环。每次可以选择环上的一段都减去 \(1\),求最少操作次数使得序列每个位置值均为 \(0\)。 思路 首先考虑一次操作会产生什么影响。 发现,会使得序列的最大值最多减 \(1\),环的差分序列最多减 \(2\)。 那么我们设 ......
Circular Addition 136C ARC 136

ARC102E Stop. Otherwise... 题解

这是一个没有必要的复杂做法,但我考场上第一时间想到的就是这个做法。 分析 首先观察样例。发现答案有对称性,所以我们只需要求出 \(\left[2,k+1\right]\) 区间内的答案。又发现相邻两项答案是一样的,所以只需要处理其中奇数情况的答案。 推式子 设 \(f_s\) 表示点数和不为 \(2 ......
题解 Otherwise 102E Stop ARC

[ARC136C] Circular Addition 题解

题意 给定一个长度为 \(N\) 的环,每次选取环上一段并使其中每个元素值均加 \(1\)。给定一个长度为 \(N\) 的序列 \(A\),环上元素初始值为 \(0\),求将环变为序列 \(A\) 的最少操作次数。 (\(1 \le N \le 2 \times 10^5, 1 \le A_i \l ......
题解 Circular Addition 136C ARC

AtCoder——第一题

AtCoder Beginner Contest 322 F Vacation Query 题目大意 处理01字符串,给定Q次询问,询问区间内最长连续1的字符个数 题目理解 使用线段树维护区间 需要使用懒标记下传修改信号 线段树要维护7个信息(区间的最长连续1的个数、区间左端点开始连续1的个数、区间 ......
AtCoder

AtCoder Grand Contest 056 D Subset Sum Game

洛谷传送门 AtCoder 传送门 考虑若 \(n\) 是奇数怎么做。枚举 Alice 第一次选的数 \(a_i\),然后考虑把剩下的数两两结成一个匹配,若 Bob 选了其中一个,Alice 就选另一个。容易发现排序后奇数位和它右边的偶数位匹配最优。那么设奇数位的和为 \(A\),偶数位的和为 \( ......
AtCoder Contest Subset Grand Game

AtCoder Beginner Contest 178 E

AtCoder Beginner Contest 178 E E - Dist Max 曼哈顿距离最大点对 \(ans = max(|x_i-x_j|+|y_i-y_j|)\) 考虑去绝对值,4种情况。sort一下取max即可。 #include <bits/stdc++.h> using name ......
Beginner AtCoder Contest 178

AtCoder Beginner Contest 322

A - First ABC 2 解题思路 签到 Code #include <bits/stdc++.h> using namespace std; typedef long long LL; void solve() { int n; cin >> n; string s; cin >> s; i ......
Beginner AtCoder Contest 322

[AtCoder] E - Packing Under Range Regulations

Key idea: For a given box and a list of balls that can be placed in this box, we should choose the ball with the smallest R. Proof: say we have box B ......
Regulations AtCoder Packing Under Range

AtCoder Beginner Contest 322

A - First ABC 2 (abc322 A) 题目大意 给定一个字符串,找到最先出现ABC的位置。 解题思路 直接查找判断即可。 神奇的代码 #include <bits/stdc++.h> using namespace std; using LL = long long; int mai ......
Beginner AtCoder Contest 322

[ARC059F] バイナリハック

2023-09-29 题目 [ARC059F] バイナリハック 难度&重要性(1~10):6 题目来源 luogu 题目算法 (纯)dp 解题思路 一道非常水的 dp 题。 先看数据 \(N\le 5000\),考虑 \(O(n^2)\) dp。 对于题目的三个操作中,我们唯一需要仔细思考的就是对于 ......
059F ARC 059

AT_arc111_a 题解

洛谷连接&Atcoder 链接 题目简述 给定两个数 \(n\) 和 \(m\),输出 \(\left\lfloor\frac{10^n}{m}\right\rfloor \bmod m\) 的值。 数据范围:\(n \le 10^{18},m \le 10^4\) 思路 首先看到数据范围还是很大的 ......
题解 AT_arc 111 arc AT

加训日记 Day3——atcoder ABC321乐子场

Day3,9.23 ·打了场acwing周赛,第三题差点就想出来了,想歪到组合数上乱选了呜呜呜 ·ABC321场写的太抽象了,A题上来wa两次,B题少考虑情况乱wa ·C题更是重量级,想不出来正确做法直接暴力,结果打表最后少写了几个数,纯纯犯病场 ·最后加了36分没绷住 acwing周赛排名 atc ......
乐子 atcoder 日记 Day3 Day

AtCoder Regular Contest 123 F Insert Addition

洛谷传送门 AtCoder 传送门 用 \((x, y)\) 表示 \(Ax + By\),那么这个等价于 SB 树。 那么直接在 SB 树上二分,遍历一遍找到 \(n\) 个点就好了。可以采用类似线段树查询的方式。 于是现在还剩下一个子问题:给定 \(a, b\),求 \(ax + by \le ......
Addition AtCoder Regular Contest Insert

[ARC135C] XOR to All 题解

include <bits/stdc++.h> typedef long long valueType; typedef std::vector ValueVector; constexpr valueType MAXB = 31; int main() { std::ios::sync_with_ ......
题解 135C ARC 135 XOR

ARC

ARC——run Adaptive Rotated Convolution for Rotated Object Detection (ICCV 2023)运行过程 Introduction This is the official implementation of the paper, Adap ......
ARC

[ARC124C] LCM of GCDs 题解

题面 给定 \(N\) 个正整数对 \((a_i, b_i)\) 和两个初始为空的集合 \(S, T\),你可以选择将每个数对的两个元素划分到两个不同的集合中。求 \[\max\operatorname{lcm}(\gcd\limits_{x \in S}x, \gcd\limits_{y \in ......
题解 124C GCDs ARC 124

AtCoder Regular Contest 127 F ±AB

洛谷传送门 AtCoder 传送门 非常妙的题。 先直观感受一下,显然当 \(M\) 大到一定程度后,\([0, M]\) 的所有数都能被取到。考虑 \(V \gets V + Ax + By\),其中 \(V + Ax + By \in [0, M]\)。如果 \(x, y\) 都是正数显然可以取 ......
AtCoder Regular Contest 127 177

[ARC125B] Squares 题解

题意 给定正整数 \(N\),求满足如下条件的正整数对 \((x, y)\) 的数量: \(1 \le x, y \le N\) \(x^2 - y\) 为完全平方数(\(0\) 也是完全平方数) (\(1 \le N \le 10^{12}\))。 题解 因为 \(x^2 - y\) 为完全平方数 ......
题解 Squares 125B ARC 125

Atcoder ABC321 笔记

A - 321-like Checker \(\color{gray}{22}\) 直接模拟 void solve() { int n; cin >> n; int lst = -1; for(int i = n; i; i /= 10) { int u = i % 10; if(u <= lst) ......
Atcoder 笔记 ABC 321

AtCoder Regular Contest 102

C - Triangular Relationship 枚举 \(a\bmod k\) 的值,\(b\bmod k,c\bmod k\) 的值也就确定了,算下贡献就好了。 #include<iostream> #include<cstdio> using namespace std; int n,k ......
AtCoder Regular Contest 102

AtCoder Regular Contest 103

C - //// 如果奇数和偶数出现的颜色的最大值相同一边取最大值和一边取次大值,否则两边都选最大值即可。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=100005; ......
AtCoder Regular Contest 103

AtCoder Grand Contest 028

A - Two Abbreviations 答案要么就是 \(\operatorname{lcm}(n,m)\) 要么就是 \(-1\)。判断下 \(\operatorname{lcm}(n,m)\) 是否合法就是了。 #include<iostream> #include<cstdio> usin ......
AtCoder Contest Grand 028