atcoder-abc medicine atcoder abc

[ABC318E] Sandwiches 题解

## 题意 给定一个长度为 $N$ 的正整数列 $A = \left(A_1, A_2, \cdots,A_N\right)$,求满足以下条件的正整数三元组 $\left(i, j, k\right)$ 的数量: - $1 \le i typedef long long valueType; typ ......
题解 Sandwiches 318E ABC 318

[ABC318E] Sandwiches 题解

一开始考虑枚举 $i$ 或 $k$ 来统计,发现需要 $O(n^2)$ 的时间复杂度。 因此考虑枚举 $j$,我们可以用 $l_x$ 表示满足 $i const int N=3e5+5; int n; int a[N]; int l[N],r[N]; long long ans,sum; int m ......
题解 Sandwiches 318E ABC 318

[ABC318D] General Weighted Max Matching 题解

因为 $n$ 很小,所以考虑状压 dp。 令 $sta$ 为一个二进制整数,表示当前第 $i$ 个点有没有被匹配。 那么显然对于每一个 $sta$ 第 $i,j$ 两点未被匹配的都可以用边 $(i,j)$ 来转移到 $sta|(1 #include typedef long long ll; con ......
题解 Weighted Matching General 318D

ABC318G Typical Path Problem

> 给定无向连通图,问是否存在一条从 $A$ 到 $C$ 经过 $B$ 的简单路径。 > $n \le 3 \times 10^5$。 怎么这个 G 这么简单我还没写完啊?怎么这个 G 这么简单我还没写完啊?怎么这个 G 这么简单我还没写完啊?怎么这个 G 这么简单我还没写完啊?怎么这个 G 这么简 ......
Typical Problem 318G Path ABC

【题解】AtCoder Beginner Contest 318(D - Ex)

赛时过了 A-G,Ex 仿佛猜到了结论但是完全不懂多项式科技,就炸了。 大家好像都秒了 A,B,C 就不写了。 ## D.General Weighted Max Matching ### 题目描述: 给你一个加权无向完全图,图中有 $N$ 个顶点,编号从 $1$ 到 $N$。连接顶点 $i$ 和 ......
题解 Beginner AtCoder Contest 318

AT_abc318_e 题解

# AT_abc318_e Sandwiches 题解 ## Links [洛谷](https://www.luogu.com.cn/problem/AT_abc318_e) [AtCoder](https://atcoder.jp/contests/abc318/tasks/abc318_e) # ......
题解 AT_abc 318 abc AT

[ABC318C] Blue Spring 题解

# [ABC318C] Blue Spring 题解 ## 题意简述 主人公出去旅游要买票,共有若干天,每天要花不同钱。现在有“通行证”出售,通过购买通行证,可以在某一天直接用通行证,以此来省去当天原本需要花费的票价。通行证只能一套一套买,每套中有 $D$ 个,买一套要花费 $P$ 元。可以购买任意 ......
题解 Spring 318C Blue ABC

AT_abc318_d 题解

# AT_abc318_d General Weighted Max Matching 题解 ## Links [洛谷](https://www.luogu.com.cn/problem/AT_abc318_d) [AtCoder](https://atcoder.jp/contests/abc31 ......
题解 AT_abc 318 abc AT

AT_abc318_c 题解

# AT_abc318_c Blue Spring 题解 ## Links [洛谷](https://www.luogu.com.cn/problem/AT_abc318_c) [AtCoder](https://atcoder.jp/contests/abc318/tasks/abc318_c) ......
题解 AT_abc 318 abc AT

AtCoder Beginner Contest 318

> 咕咕咕,总力战还没打,凹不过卷狗,躺了.jpg ## [A - Full Moon (abc318 A)](https://atcoder.jp/contests/abc318/tasks/abc318_a) ### 题目大意 给定$n, m, p$,问有多少个 $i$满足 $0 神奇的代码 ` ......
Beginner AtCoder Contest 318

AtCoder Beginner Contest 318

## A - Full Moon ### Problem Statement Takahashi likes full moons. Let today be day $1$. The first day on or after today on which he can see a full mo ......
Beginner AtCoder Contest 318

ABC318

## T1:[Full Moon](https://atcoder.jp/contests/abc318/tasks/abc318_a "Full Moon") 模拟 代码实现 ``` n, m, p = map(int, input().split()) ans = 0 i = m while i ......
ABC 318

ABC317题解报告

我直接从第三题开始讲了。 [T3](https://atcoder.jp/contests/abc318/tasks/abc318_c) 把数组 $A$ 从大到小排序。 然后从前往后把前 $q$ 个数加起来,然后判断这 $q$ 个数的和与 $d$ 的大小关系,如果大了就变成 $d$。 然后有些细节就 ......
题解 报告 ABC 317

ABC317

## T1:[Potions](https://atcoder.jp/contests/abc317/tasks/abc317_a "Potions") 模拟 代码实现 ``` n, h, x = map(int, input().split()) p = list(map(int, input() ......
ABC 317

AtCoder Beginner Contest 201 E - Xor Distances

# E - Xor Distances [原题链接](https://atcoder.jp/contests/abc201/tasks/abc201_e) 题意:设dist(i,j)即i到j之间路径的异或和,求树上所有两点之间dist(i,j)的和 思路:dist(i,j) = dist(i,1)^ ......
Distances Beginner AtCoder Contest 201

AtCoder Beginner Contest 201 D - Game in Momotetsu World

# D - Game in Momotetsu World [原题链接](https://atcoder.jp/contests/abc201/tasks/abc201_d) 题意 有一个 H×W 的方格,每个方格里写着 '+' 或 '-' 有一个初始在 (1,1),(也就是左上角)的棋子, Tak ......
Momotetsu Beginner AtCoder Contest World

AtCoder Beginner Contest 317 D - President

# D - President [原题链接](https://atcoder.jp/contests/abc317/tasks/abc317_d) 题意:一共n轮,每一轮Xi > Yi (票数)时,X可以获得Zi 张席位,反之亦然;最终席位总和多的就获胜;因此要使X获胜,求Y至少要给X多少个票 思路 ......
President Beginner AtCoder Contest 317

AtCoder Beginner Contest 317 C - Remembering the Days

# C - Remembering the Days [原题链接](https://atcoder.jp/contests/abc317/tasks/abc317_c) 题意:每个点最多经过一次,求最长路 思路:数据范围很小,深搜每个点能到其他点的所有路,取最大 ```c++ #include us ......
Remembering Beginner AtCoder Contest Days

AtCoder Beginner Contest 317

# A - Potions ```cpp #include using namespace std; #define int long long int power(int x, int y, int p) { x %= p; int ans = 1; while (y) { if (y & 1) ......
Beginner AtCoder Contest 317

AtCoder Beginner Contest 296 C - Gap Existence

# C - Gap Existence [原题链接](https://atcoder.jp/contests/abc296/tasks/abc296_c) 题意:是否存在Ai - Aj = x 思路:排序,双指针 ```c++ #include using namespace std; const ......
Existence Beginner AtCoder Contest 296

AtCoder Beginner Contest 292 E - Transitivity

# E - Transitivity [原题链接](https://atcoder.jp/contests/abc292/tasks/abc292_e) 题意:对于一个有向图,进行加边操作,使最终任意的个点具有传递效果,即若a到b有边,b到c有边,那么a到c也要有边,问最少需要进行多少次操作,使得每 ......
Transitivity Beginner AtCoder Contest 292

AtCoder Beginner Contest 292 D - Unicyclic Components

# D - Unicyclic Components [原题链接](https://atcoder.jp/contests/abc292/tasks/abc292_d) 题意:判断一个连通块的边和点个数是否相同 思路:对它使用并查集吧 点击查看代码 ``` #include using namesp ......

ABC 317 A - G

# ABC 317 A - G 代码去 Atcoder 全部提交搜索 Std_Code 查看代码 [懒人专用](https://atcoder.jp/contests/abc317/submissions?f.Task=&f.LanguageName=&f.Status=&f.User=Std_Co ......
ABC 317

abc302f

[abc302f](https://atcoder.jp/contests/abc302/tasks/abc302_f) 不是很难,但是还是有点绕 很明显是一个图的模型 但是边数很大 我们只关心每种数最早什么时候能够得到 对于每一种数,我们记录哪些集合包含它,每得到一个新的数,就用它来更新 ```c ......
302f abc 302

ABC做题记录

做之前没有想到AT的题还是有一定难度的,加油! ### ABC317 #### E - Avoid Eye Contact 随便bfs一下就好 #### F - Nim 考虑数位dp,用 $dp[x][r1][r2][r3][d1][d2][d3][z1][z2][z3]$ 记录位数,余数,最高位限 ......
ABC

AtCoder Regular Contest 164

# Preface 补一下好久之前的ARC,ABC的话如果没事会考虑从后往前补一下 # **A - Ternary Decomposition** 首先判掉当$k>n$时一定无解,否则可以贪心地对$n$进行三进制分解,得到最少可以拆成$k'$个数 不难发现我们总可以把其中较大的数拆成三个小的,以此来 ......
AtCoder Regular Contest 164

Atcoder Beginner Contest 317 解题报告

# Atcoder Beginner Contest 317 ABC316 咋没了。 暂时 A~E。 ## Hints D $\quad$可以算出每次选举需要的改票数。然后变成了一个经典问题。 E $\quad$有点 naive。不用担心暴力扫 T 掉,时间复杂度是真的。 F $\quad$F1 $ ......
Beginner Atcoder Contest 报告 317

AtCoder Beginner Contest 317 F - Nim

## 数位 DP ```cpp #include using namespace std; using ll = long long; int dp[64][10][10][10][2][2][2][2][2][2]; int main() { ll n; int b1, b2, b3; cin > ......
Beginner AtCoder Contest 317 Nim

abc265e Warp

[Warp](https://atcoder.jp/contests/abc265/tasks/abc265_e) 大概就是个dp f[n][x][y]表示走了n步,第一种走了x次,第二种走了y次。 不过写来写去发现都会TLE,N^3怎么会TLE呢? 后面发现原来是map的写法一直有问题, 比如判断 ......
265e Warp abc 265

ABC317F题解

让人头大的数位DP。建议评蓝。个人认为不适合放ABC的F。 将三个数二进制拆分,使三个数异或为0相当于每个二进制位三个数中有0或2个是1。 所以考虑数位DP,设 $dp[i][m1][m2][m3][lim1][lim2][lim3]$ 为第 $i$ 位,三个数模 $a$ , $b$ , $c$ 分 ......
题解 317F ABC 317