atcoder equal 100d arc

[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

AtCoder Grand Contest 027

A - Candy Distribution Again 从小到大贪心,可以发现一定是满足一个前缀,暴力判断就行了。 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=10 ......
AtCoder Contest Grand 027

AtCoder Grand Contest 026

A - Colorful Slimes 2 可以发现,对于连续的一段长度为 \(m\) 的相同的字符,我们可以花费 \(\lfloor \frac{m}{2}\rfloor\) 的代价将它改为符合要求的。 #include<iostream> #include<cstdio> using names ......
AtCoder Contest Grand 026

AtCoder Grand Contest 025

A - Digits Sum 按题意模拟即可。 #include<iostream> #include<cstdio> using namespace std; const int INF=1061109567; int n; int calc(int x) { int res=0; while(x ......
AtCoder Contest Grand 025

AtCoder Grand Contest 024

A - Fairness 每次操作后 \(a_i-b_i=b_{i-1}-a_{i-1}\),对 \(k\) 的奇偶性讨论一下即可。 #include<iostream> #include<cstdio> using namespace std; int a,b,c; long long k; in ......
AtCoder Contest Grand 024

AtCoder Grand Contest 023

A - Zero-Sum Ranges 令 \(s_n=\sum\limits_{i=1}^n a_i\),相当于找满足 \(l\le r,s_r-s_{l-1}\) 的点对 \((l,r)\) 的个数,直接搞就完事了。 #include<iostream> #include<cstdio> #in ......
AtCoder Contest Grand 023

AtCoder Grand Contest 022

A - Diverse Word 如果至少有一个字符没有出现过,只要在原字符串后面加入一个没有出现过的字符中最小的那个字符就好了。 如果所有字符都出现过,找到一个尽量靠后的位置 \(i\in [1,n)\),使得 \(s_i\lt s_{i+1}\),最优字符串将 \(s_i\) 换成 \([i+1 ......
AtCoder Contest Grand 022

AtCoder Grand Contest 021

A - Digit Sum 2 要么是 \(n\) 要么是 \(n\) 的第一位后面加上若干个 \(9\)。 #include<iostream> #include<cstdio> #include<cmath> using namespace std; long long n; int calc( ......
AtCoder Contest Grand 021

AtCoder Grand Contest 041

A - Table Tennis Training 如果 \(n\) 为偶数,一个 \(+1\) 一个 \(-1\) 即可。 如果 \(n\) 为奇数,那么肯定有一个先到了 \(1\) 或 \(n\),然后再 \(+1,-1\),取个较小值即可。 代码: #include<iostream> #in ......
AtCoder Contest Grand 041

AtCoder Grand Contest 040

A - >< 将所有的连续段缩起来,如果这个区间为 <,则左端点为 \(0\),依次递增;如果这个区间为 >,则右端点为 \(0\),分界点取个左右的 \(\max\) 就好了。 #include<iostream> #include<cstdio> #include<cstring> using ......
AtCoder Contest Grand 040

AtCoder Grand Contest 039

A - Connection and Disconnection 对于连续的一段连续的长度为 \(L\) 的段,至少需要 \(\frac{L}{2}\) 次操作。判下头尾相等的情况,实现时注意细节即可。 #include<iostream> #include<cstdio> #include<cst ......
AtCoder Contest Grand 039

AtCoder Grand Contest 037

A - Dividing a String 可以发现,划分后的子串的长度不可能大于 \(2\)。令 \(f_{i,1/2}\) 表示到第 \(i\) 位,当前位置划分的子串长度为 \(1/2\) 的最大的 \(K\),转移枚举一下 \(i-1,i-2\) 即可。 #include<iostream> ......
AtCoder Contest Grand 037

AtCoder Grand Contest 036

A - Triangle 考虑 \(x_1,y_1\) 选原点,构造另外两个点。考虑叉积的形式,可以得出: \[x_2y_3+x_3y_2=S \]令 \(x_2=y_3=\lceil \sqrt S\rceil\),令 \(t=S-x_2y_3\),暴力枚举 \(t\) 的因数即可。 #inclu ......
AtCoder Contest Grand 036

AtCoder Grand Contest 035

A - XOR Circle 可以发现,相邻三个数的异或和一定为 \(0\)。如果三个字符已经确定了,那么整个字符串就已经确定为这三个字符构成,且序列唯一。 如果 \(n\bmod 3\ne 0\),显然无解。 如果字符集的大小大于 \(3\),显然无解。 如果字符集的大小等于 \(3\),只有在这 ......
AtCoder Contest Grand 035

AtCoder Grand Contest 034

Kenken Race 可以分成两种情况: 当 \(A\leq B\leq C\leq D\) 时,先让 \(B\) 到 \(D\),在让 \(A\) 到 \(C\); 当 \(A\leq B\leq D\leq C\) 时,判断一下 \(B\to D\) 是否有三个连续的 .。 然后判断一下 \( ......
AtCoder Contest Grand 034

AtCoder Grand Contest 033

A - Darker and Darker 从 # 向外广搜即可。 #include<iostream> #include<cstdio> #include<cstring> #include<queue> using namespace std; const int N=1005; const i ......
AtCoder Contest Grand 033

AtCoder Grand Contest 032

A - Limited Insertion 考虑从后往前做,插数变成了删数。可以发现,我们可以删去的只有 \(a_i=i\) 的数,如果有多个肯定删最后面的是最优的,因为这样影响到的数最少。每次扫一遍找出删什么数即可。 #include<iostream> #include<cstdio> usin ......
AtCoder Contest Grand 032

AtCoder Grand Contest 030

A - Poisonous Cookies 解毒的饼干肯定所有都吃,剩下的算一下最多能吃多少毒饼干就好了。 #include<iostream> #include<cstdio> using namespace std; int A,B,C; int main() { scanf("%d%d%d", ......
AtCoder Contest Grand 030