惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog RSS Feed
C
CERT Recently Published Vulnerability Notes
P
Proofpoint News Feed
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
H
Help Net Security
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Full Disclosure
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
爱范儿
爱范儿
Security Archives - TechRepublic
Security Archives - TechRepublic
Simon Willison's Weblog
Simon Willison's Weblog
Cisco Talos Blog
Cisco Talos Blog
I
InfoQ
T
Tenable Blog
T
Tor Project blog
人人都是产品经理
人人都是产品经理
D
DataBreaches.Net
NISL@THU
NISL@THU
Google DeepMind News
Google DeepMind News
博客园 - 叶小钗
B
Blog
V
V2EX
Jina AI
Jina AI
L
LangChain Blog
月光博客
月光博客
W
WeLiveSecurity
U
Unit 42
AWS News Blog
AWS News Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
博客园 - 聂微东
V
Visual Studio Blog
A
Arctic Wolf
T
Tailwind CSS Blog
The Cloudflare Blog
SecWiki News
SecWiki News
S
SegmentFault 最新的问题
Hacker News - Newest:
Hacker News - Newest: "LLM"
宝玉的分享
宝玉的分享
MyScale Blog
MyScale Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Securelist
www.infosecurity-magazine.com
www.infosecurity-magazine.com
腾讯CDC
雷峰网
雷峰网

Shiroha白羽的博客

Golang 踩坑 —— interface 为参数的时候传 nil 指针 Codeforces Round 925 (Div. 3) Codeforces Round 924 (Div. 2) Codeforces Round 923 (Div. 3) Codeforces Round 922 (Div. 2) Codeforces Round 921 (Div. 2) Educational Codeforces Round 161 (Rated for Div. 2) Codeforces Round 920 (Div. 3) Codeforces Round 919 (Div. 2) Hello 2024 Good Bye 2023 Codeforces Round 918 (Div. 4) 个人备份的常用 macOS 清理命令 Codeforces Round 917 (Div. 2) Pinely Round 3 (Div. 1 + Div. 2) Educational Codeforces Round 160 (Rated for Div. 2) Codeforces Round 915 (Div. 2) Codeforces Round 914 (Div. 2) Codeforces Round 913 (Div. 3) Educational Codeforces Round 159 (Rated for Div. 2) Codeforces Round 912 (Div. 2) Codeforces Round 911 (Div. 2) CodeTON Round 7 (Div. 1 + Div. 2, Rated, Prizes!) Educational Codeforces Round 158 (Rated for Div. 2) Codeforces Round 910 (Div. 2) Codeforces Round 909 (Div. 3) Codeforces Round 908 (Div. 2) Educational Codeforces Round 157 (Rated for Div. 2) C++自定义的字面量 Codeforces Round 907 (Div. 2) Codeforces Round 916 (Div. 3) 关于 LRU map 的一些灵感 2023 杭州站 ICPC 现场赛 反复横跳的 Clang-Tidy(cert-dcl21-cpp) Codeforces Round 906 (Div. 2) 一段奇怪的 CPP 代码 Codeforces Round 905 (Div. 3) Codeforces Round 904 (Div. 2) Codeforces Round 903 (Div. 3) Educational Codeforces Round 156 (Rated for Div. 2) Codeforces Round 901 (Div. 2) Codeforces Round 900 (Div. 3) Codeforces Round 899 (Div. 2) Educational Codeforces Round#155 (Div. 2) Codeforces Round 898 (Div. 4) CodeTON Round 6 (Div. 2) Codeforces Round 897 (Div. 2) Codeforces Round 896 (Div. 2) Codeforces Round 887 (Div. 2) Codeforces Round 895 (Div. 3) 左值-右值-将亡值 blog.mauve.icu Pinely Round 2 (Div. 1 + Div. 2) Harbour.Space Scholarship Contest 2023-2024 (Div. 1 + Div. 2) Codeforces Round 894 (Div. 3) Codeforces Round 888 (Div. 3) Educational Codeforces Round#153 (Div. 2) Codeforces Round 893 (Div. 2) OTPAUTH,两步验证中的通用协议 Codeforces Round 892 (Div. 2) Codeforces Round 891 (Div. 3) Codeforces Round 890 (Div. 2) Educational Codeforces Round#152 (Div. 2) blog.mauve.icu Java Script 的 null 和 undefined 随想 记一次 SQL LEFT JOIN 没有得到预期结果的错误 Codeforces Round#789(Div. 2) GCC/G++ 预编译头性能优化 使用 Junit5 和 Mockito 实现 SpringBoot 的单元测试最优美的解决方案 centOS 防火墙 docker-compse 的问题 C++ 语言实现动态变化的线程池 Codeforces Round#744 (Div. 3) 计算机图形学 Windows 通过网络访问 WSL2 原生 JavaScript 实现图片裁剪 面试复习(计算机图形学) 面试复习(算法) Codeforces Round#706(Div. 2)-Let's Go Hiking 面试复习(Java) 面试复习(Git) 面试复习(Linux) 面试复习(数据库) 面试复习(计算机网络) 面试复习(操作系统) 面试复习(C++) Codeforces Round#699 (Div. 2) 清理 WSL2 的磁盘占用 Codeforces Round#697 (Div. 3) Windows 下的 NTFS 驱动器索引 BUG 计算机网络复习 记一次 Navicat 连接 MySQL 一直报认证错误(Access denied) 计算机网络实验复习 WSL1 使用 Docker 一直无法启动 我的ACM脚印 2020牛客暑期多校训练营(第三场)D-Points Construction Problem——构造 2020牛客暑期多校训练营(第三场)E-Two Matchings——复杂思维与简单dp 2020牛客暑期多校训练营(第二场)I-Interval——最大流转对偶图求最短路 Educational Codeforces Round 80 D. Minimax Problem——二分+二进制处理 Codeforces Round 606 E. Two Fairs——图论 Codeforces Round 612 (Div. 2) C. Garland——DP
Codeforces Round 902 (Div. 2, based on COMPFEST 15 - Final Round)
Shiroha · 2023-10-29 · via Shiroha白羽的博客

A. Goals of Victory

大致题意

有 $n$ 只队伍,所有队伍两两对战,两个队伍因此得分之和一定为 0。将每个队伍的所有得分之和相加,现在已知其中 $n-1$ 个队伍的得分情况,问最后一个队伍的得分情况是

思路

简单题,说白了就是所有人分数之和肯定是 $0$,那就把剩下的人都加起来,取负数就行了

AC code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
void solve() {
int _;
cin >> _;
for (int ts = 0; ts < _; ++ts) {
int n;
cin >> n;
int tot = 0;
for (int i = 0; i < n - 1; ++i) {
int tmp;
cin >> tmp;
tot += tmp;
}
cout << -tot << endl;
}
}

B. Helmets in Night Light

大致题意

村长需要通知村里的所有人一个消息,村长每通知一个人,就要花费 $k$ 的成本,而听到消息的村民也可以相互通知,每个村民最多再通知 $a_i$ 个其他村民,同时每通知一个其他村民就要花费 $b_i$ 的费用,问最少的费用

思路

村长可以无限通知,但是成本固定,所以能让成本低的村民通知的情况下,村长只需要通知一次即可,当成本低的村民的通知机会都用完了之后,剩下的都村长通知一下就行了

AC code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#define int long long

void solve() {
int _;
cin >> _;
for (int ts = 0; ts < _; ++ts) {
int n, p;
cin >> n >> p;
vector<pair<int, int>> data(n);
for (auto &i: data) cin >> i.second;
for (auto &i: data) cin >> i.first;
int cost = p, cnt = 1;
sort(data.begin(), data.end());
for (auto &i: data) {
if (i.first >= p) break;
int c = min(n - cnt, i.second);
cnt += c;
cost += c * i.first;
if (cnt == n) break;
}
cost += p * (n - cnt);
cout << cost << endl;
}
}

C. Joyboard

大致题意

有一个数组 $a$,其长度为 $n+1$,现在需要往第 $n+1$ 这个位置上放上一个在 $[0, m]$ 的整数,然后对于每一个 $a_i = a_{i+1} % i$ 问,如果希望整个数组中恰好有 $k$ 种不同的数字,则 $n+1$ 这个位置上的选择有多少

思路

首先,无论最终填上的值有多大,最终只要经过第一层 $mod$ 操作后,其值一定在 $[0, n)$ 之间了,且经历第二次 $mod$ 操作后,一定会变成 $0$(因为计算是从大到小进行计算的,所以一定会遇到相同的值,否则都是大于当前值的,不会改变 $mod$ 的结果)。所以最终一定最多只能存在 $3$ 个不同的数字。

那么什么时候为 $1$ 个呢,也很简单,因为最终一定为 $0$,故开始值也必须为 $0$

然后是两个的情况,那么如果我一开始的值就是在 $[0, n)$ 之内,那么必然也可以满足,因为遇到的第一个可以 $mod$ 的值就是它自己

但是要考虑一种特殊情况,那就是恰好是 ${n, 2 \times n, 3 \times n \dots}$ 的情况,因为虽然不在 $[0, n)$ 之内,但是第一次 $mod$ 会直接变成 $0$

AC code

1
2
3
4
5
6
7
8
9
10
11
12
void solve() {
int _;
cin >> _;
for (int ts = 0; ts < _; ++ts) {
int n, m, k;
cin >> n >> m >> k;
if (k == 1) cout << 1 << endl;
else if (k == 2) cout << min(m, n) + (m > n ? (m / n) - 1 : 0) << endl;
else if (k == 3) cout << max(0, m - n) - (m > n ? (m / n) - 1 : 0) << endl;
else cout << 0 << endl;
}
}

D. Effects of Anti Pimples

大致题意

有一个数组 $a$,开始的时候都是白色,每次可以任意选择一个或者几个数字,将其染上黑色。然后将每个黑色的位置下标的倍数处,染成绿色。最后从不是白色的块中选出值最高的。问所有的选择情况下,所有得到的值之和是多少

思路

看起来很简单,但是实际上也非常简单的题

如果一个值被染成黑色,那么其能够带来的效果是确定的,即其倍数上的节点中最大的那个,我们将其先成为可能最大值

接下来是统计每个最大值的出现的次数,简单来说就是相同的可能最大值中挑选任意几个(至少一个),然后在剩下的可能最大值小于当前值中挑选 $0$ 个或者多个即可,即 $\sum{i=1}^{t} \binom{i}{t} * \sum{i=0}^{n-t} \binom{i}{n-t}$

而这里的求和又非常的简单,因为 $\sum_{i=0}^{x} \binom{i}{x} = 2^x$,所以,就非常简单了

AC code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#define int long long

void solve() {
const int mod = 998244353;
vector<int> c0(1e5+10), c1(1e5+10);
c0[0] = 1;
c1[0] = 0;
for (int i = 1; i < c0.size(); ++i) {
c0[i] = (c0[i - 1] * 2) % mod;
c1[i] = (c0[i] + mod - 1) % mod;
}

int n;
cin >> n;
vector<int> data(n), top(n);
for (auto &i: data) cin >> i;
for (int i = 0; i < n; ++i) {
top[i] = data[i];
for (int j = i + 1; j <= n; j += i + 1)
top[i] = max(top[i], data[j - 1]);
}
map<int, int> cnt;
for (auto &i: top) cnt[i]++;
int last = n, ans = 0;
for (auto iter = cnt.rbegin(); iter != cnt.rend(); ++iter) {
last -= iter->second;
ans = (ans + ((iter->first * ((c1[iter->second] * c0[last]) % mod)) % mod)) % mod;
}
cout << ans << endl;
}