Solution Set -「ABC 205」
应该是最近最水的 ABC 了吧。
「ABC 205A」kcal
Link.
略
#include <bits/stdc++.h>
using ll = long long;
#define all(x) (x).begin(), (x).end()
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
ll a, b;
std::cin >> a >> b;
std::cout << b * a / 100.0 << "\n";
return 0;
}
「ABC 205B」Permutation Check
Link.
排序 / std::set 均可。
#include <bits/stdc++.h>
using ll = long long;
#define all(x) (x).begin(), (x).end()
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
int n, cur = 0;
std::cin >> n;
std::vector<int> a(n);
for (int &x : a) {
std::cin >> x;
--x;
}
std::sort(all(a));
for (int x : a) {
if (cur != x) {
std::cout << "No\n";
return 0;
}
++cur;
}
std::cout << "Yes\n";
return 0;
}
「ABC 205C」POW
Link.
若 \(c\) 为偶数则 \(a:=|a|,b:=|b|\),然后比较 \(a,b\) 大小即可。
#include <bits/stdc++.h>
using ll = long long;
#define all(x) (x).begin(), (x).end()
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
int a, b, c;
std::cin >> a >> b >> c;
if (c % 2 == 0) {
a = std::abs(a);
b = std::abs(b);
}
if (a > b) std::cout << ">\n";
else if (a < b) std::cout << "<\n";
else std::cout << "=\n";
return 0;
}
「ABC 205D」Kth Excluded
Link.
预处理每一个数空出来的位置,然后询问时二分分类讨论。
#include <bits/stdc++.h>
using ll = long long;
#define all(x) (x).begin(), (x).end()
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
int n, q;
std::cin >> n >> q;
std::vector<ll> a(n), b(n);
for (ll &x : a) std::cin >> x;
for (size_t i = 0; i < a.size(); ++i) b[i] = a[i] - i - 1;
for (ll k; q; --q) {
std::cin >> k;
ll pos = std::lower_bound(all(b), k) - b.begin();
if (pos == n) std::cout << a.back() + k - b.back() << "\n";
else std::cout << a[pos] - b[pos] + k - 1 << "\n";
}
return 0;
}
「ABC 205E」White and Black Balls
Link.
答案显然是 \(\binom{n+m}{n}-\binom{n+m}{n-k-1}\)。
#include <bits/stdc++.h>
using ll = long long;
#define all(x) (x).begin(), (x).end()
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
constexpr int MOD = 1e9 + 7;
int n, m, k;
std::cin >> n >> m >> k;
std::vector<ll> fac(n + m + 1), ifac(n + m + 1);
auto pow = [&] (ll x, int y) {
ll res = 1;
for (; y; y >>= 1, x = x * x % MOD)
if (y & 1) res = res * x % MOD;
return (res + MOD) % MOD;
};
fac[0] = ifac[0] = 1;
for (int i = 1; i < n + m + 1; ++i) {
fac[i] = fac[i - 1] * i % MOD;
ifac[i] = pow(fac[i], MOD - 2);
}
auto C = [&] (int n, int k) {return n < k ? 0 : fac[n] * ifac[n - k] % MOD * ifac[k] % MOD;};
if (n - m > k) std::cout << "0\n";
else std::cout << (C(n + m, n) - C(n + m, n - k - 1) + MOD) % MOD << "\n";
return 0;
}
「ABC 205F」Grid and Tokens
Link.
网络流板题。
#include <bits/stdc++.h>
#include <atcoder/maxflow>
using ll = long long;
#define all(x) (x).begin(), (x).end()
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
int h, w, n;
std::cin >> h >> w >> n;
std::vector<std::vector<int>> obj(n, std::vector<int>(2));
std::vector<int> row(h), col(w);
auto id = [&] () {
static int cnt = 0;
return cnt++;
};
const int S = id(), T = id();
for (int &x : row) x = id();
for (int &x : col) x = id();
for (std::vector<int> &x : obj) x = std::vector<int>({id(), id()});
atcoder::mf_graph<int> G(id());
for (int x : row) G.add_edge(S, x, 1);
for (int x : col) G.add_edge(x, T, 1);
for (int i = 0; i < n; ++i) {
int a, b, c, d;
std::cin >> a >> b >> c >> d;
--a, --b;
G.add_edge(obj[i][0], obj[i][1], 1);
for (int j = a; j < c; ++j) G.add_edge(row[j], obj[i][0], 1);
for (int j = b; j < d; ++j) G.add_edge(obj[i][1], col[j], 1);
}
std::cout << G.flow(S, T) << "\n";
return 0;
}
Solution Set -「ABC 205」的更多相关文章
- Solution Set -「ABC 217」
大家好屑兔子又来啦! [A - Lexicographic Order] 说个笑话,\(\color{black}{\text{W}}\color{red}{\text{alkingDead} ...
- Diary / Solution Set -「WC 2022」线上冬眠做噩梦
大概只有比较有意思又不过分超出能力范围的题叭. 可是兔子的"能力范围" \(=\varnothing\) qwq. 「CF 1267G」Game Relics 任意一个 ...
- Solution Set -「ARC 107」
「ARC 107A」Simple Math Link. 答案为: \[\frac{a(a+1)\cdot b(b+1)\cdot c(c+1)}{8} \] 「ARC 107B」Quadrup ...
- Solution -「ABC 219H」Candles
\(\mathcal{Description}\) Link. 有 \(n\) 支蜡烛,第 \(i\) 支的坐标为 \(x_i\),初始长度为 \(a_i\),每单位时间燃烧变短 \(1\) ...
- Solution -「ABC 215H」Cabbage Master
\(\mathcal{Description}\) Link. 有 \(n\) 种颜色的,第 \(i\) 种有 \(a_i\) 个,任意两球互不相同.还有 \(m\) 个盒子,每个盒子可以被放 ...
- Solution -「ABC 213G」Connectivity 2
\(\mathcal{Description}\) Link. 给定简单无向图 \(G=(V,E)\),点的编号从 \(1\) 到 \(|V|=n\).对于 \(k=2..n\),求 \(H= ...
- Solution -「ABC 213H」Stroll
\(\mathcal{Description}\) Link. 给定一个含 \(n\) 个结点 \(m\) 条边的简单无向图,每条边的边权是一个常数项为 \(0\) 的 \(T\) 次多项式, ...
- Solution -「ABC 217」题解
D - Cutting Woods 记录每一个切割点,每次求前驱后驱就好了,注意简单判断一下开闭区间. 考场上采用的 FHQ_Treap 无脑莽. #include <cstdio> #i ...
- 「ABC 249Ex」Dye Color
考虑停时定理. 初始势能为 \(\sum \Phi(cnt_i)\),末势能为 \(\Phi(n)\),我们希望构造这样一个 \(\Phi:Z\to Z\) 函数,使得每一次操作期望势能变化量为常数. ...
- Note -「Lagrange 插值」学习笔记
目录 问题引入 思考 Lagrange 插值法 插值过程 代码实现 实际应用 「洛谷 P4781」「模板」拉格朗日插值 「洛谷 P4463」calc 题意简述 数据规模 Solution Step 1 ...
随机推荐
- tomghost
思路: 先使用端口扫描,会发现22,8009,8080 8009的考察点:tomcat ajp协程属性设置导致的文件读取和文件执行. https://github.com/00theway/Ghost ...
- 解密Prompt系列9. 模型复杂推理-思维链COT基础和进阶玩法
终于写了一篇和系列标题沾边的博客,这一篇真的是解密prompt!我们会讨论下思维链(chain-of-Thought)提示词究竟要如何写,如何写的更高级.COT其实是Self-ASK,ReACT等利用 ...
- 微信公众号redirect_uri 参数错误
前期所有准备工作我就不在这里一一叙述了.在这说一下需要注意的事项: 1.如果域名为www开头,记得把www去掉,否则依旧会报这个错误 2.跳转域名必须是授权域名的子集,如:'授权域名为 www.bai ...
- 前端vue uni-app基于uQRCode封装简单快速实用全端二维码生成插件
快速实现基于uQRCode封装简单快速实用全端二维码生成插件; 下载完整代码请访问uni-app插件市场地址:https://ext.dcloud.net.cn/plugin?id=12677 效果图 ...
- 记录一个在写项目中遇到的Maven依赖无法导入的问题
记录一个在写项目中遇到的Maven依赖无法导入的问题 项目是一个父项目做依赖管理,三个子项目,今天遇到一个问题: 子项目中导入的依赖,怎么都导入不进去,maven仓库中已经有了,idea提示也没有问题 ...
- Vue3从入门到精通(三)
vue3插槽Slots 在 Vue3 中,插槽(Slots)的使用方式与 Vue2 中基本相同,但有一些细微的差异.以下是在 Vue3 中使用插槽的示例: // ChildComponent.vue ...
- SQL专家云回溯某时间段内的阻塞
背景 SQL专家云像"摄像头"一样,对环境.参数配置.服务器性能指标.活动会话.慢语句.磁盘空间.数据库文件.索引.作业.日志等几十个运行指标进行不同频率的实时采集,保存到SQL专 ...
- ZEGO即构科技荣获36氪【WISE2020中国新经济之王最具影响力企业】
12月8-10日,36氪重磅新经济峰会WISE2020新经济之王大会将在北京举办.近日,2020新经济之王--中国最具影响力企业榜单陆续发布,全球云通讯服务商即构科技,凭借在企业服务领域硬核出色的技术 ...
- PlayWright(二十一)- Pytest插件报告
1.下载 pytest框架有官方的报告pip install pytest-html 下载成功,那我们怎么使用呢? 2.使用 可以直接在配置文件里使用 在 pytest 配置文件中, 增加 ...
- BigCode 背后的大规模数据去重
目标受众 本文面向对大规模文档去重感兴趣,且对散列 (hashing) .图 (graph) 及文本处理有一定了解的读者. 动机 老话说得好: 垃圾进,垃圾出 (garbage in, garbage ...