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

推荐订阅源

Google Online Security Blog
Google Online Security Blog
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
人人都是产品经理
人人都是产品经理
The Hacker News
The Hacker News
W
WeLiveSecurity
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
博客园 - 司徒正美
雷峰网
雷峰网
L
LINUX DO - 最新话题
博客园 - 叶小钗
云风的 BLOG
云风的 BLOG
The Last Watchdog
The Last Watchdog
V2EX - 技术
V2EX - 技术
S
Security Affairs
有赞技术团队
有赞技术团队
月光博客
月光博客
T
Threatpost
T
Tor Project blog
O
OpenAI News
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
V
V2EX
Know Your Adversary
Know Your Adversary
Project Zero
Project Zero
博客园 - 三生石上(FineUI控件)
D
Docker
AWS News Blog
AWS News Blog
AI
AI
P
Proofpoint News Feed
K
Kaspersky official blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
D
Darknet – Hacking Tools, Hacker News & Cyber Security
www.infosecurity-magazine.com
www.infosecurity-magazine.com
S
Securelist
F
Fortinet All Blogs
F
Full Disclosure
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
量子位
Hacker News - Newest:
Hacker News - Newest: "LLM"
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Palo Alto Networks Blog
Cyberwarzone
Cyberwarzone
Cisco Talos Blog
Cisco Talos Blog
美团技术团队
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog

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) 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 902 (Div. 2, based on COMPFEST 15 - Final Round) 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 908 (Div. 2)
Shiroha · 2024-01-03 · via Shiroha白羽的博客

A. Secret Sport

大致题意

有 A 和 B 两个人,他们在比赛,每一局比赛中,率先赢得 $n$ 小场的人获胜,最终赢得 $m$ 局的人获胜,给出每一小场的获胜情况,问最终谁获胜了

思路

没有那么麻烦,说白了最后一个获胜的人,必定是最终获胜的人

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;
cin >> n;
string str;
str.reserve(n);
cin >> str;
cout << str.back() << endl;
}
}

B. Two Out of Three

大致题意

有一个数组 $a$,希望构建一个数组 $b$,满足下面三条中的任意两条,且仅满足两条

  • 存在一个 $i,j \in [1, n]$,满足 $a_i = a_j, b_i = 1, b_j = 2$
  • 存在一个 $i,j \in [1, n]$,满足 $a_i = a_j, b_i = 1, b_j = 3$
  • 存在一个 $i,j \in [1, n]$,满足 $a_i = a_j, b_i = 2, b_j = 3$

思路

注意是要仅满足两条,所以只需要满足任意两组相同的数值对即可。即存在两个数字,他们出现次数至少两次,即可

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
31
32

void solve() {
int _;
cin >> _;
for (int ts = 0; ts < _; ++ts) {
int n;
cin >> n;
vector<int> data(n);
for (auto& i: data) cin >> i;
map<int, int> cnt;
for (const auto& i: data) ++cnt[i];
vector<int> two;
for (auto [fst, snd]: cnt) {
if (snd >= 2) two.push_back(fst);
}
if (two.size() > 1) {
int flag[2] = {0, 0};
for (int i = 0; i < n; ++i) {
if (data[i] == two[0]) {
cout << (flag[0] == 0 ? 1 : 2) << ' ';
++flag[0];
} else if (data[i] == two[1]) {
cout << (flag[1] == 0 ? 1 : 3) << ' ';
++flag[1];
} else cout << 1 << ' ';
}
cout << endl;
} else {
cout << -1 << endl;
}
}
}

C. Anonymous Informant

大致题意

有一个初始的数组,未知长什么样子,但是经过 $n$ 次,操作后得到了当前数组,问是否存在原来的数组

操作的方式是,选择一个 $i$,满足 $a_i = i$,并将整个数组左移 $i$ 次

思路

每个值,当其恰好满足 $a_i = i$ 的时候,即可完成一次固定的移动,从最终结果我们来看,说白了就是可以从某个固定的旋转次数到另外某个固定的移动次数

那么说白了就是一个图,这样我们就可以根据旋转次数作为图的下标,建图

接下来需要找的就是拓扑后,最终旋转次数为 0 次的时候,拓扑长度最多为多少次,或者存在包含 0 节点的环即可

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
void solve() {
int _;
cin >> _;
for (int ts = 0; ts < _; ++ts) {
int n, k;
cin >> n >> k;
vector<int> data(n);
for (auto& i: data) cin >> i;

struct node {
int v, n;
};
vector<node> edge(n);
vector head(n, -1), deg(n, 0);

for (int i = 0; i < n; ++i) {
if (data[i] > n) continue;
const int u = (i + 1 - data[i] + n) % n;
const int v = (u + data[i]) % n;
edge[i] = {v, head[u]};
head[u] = i;
++deg[v];
}

vector<int> vis(n + 1, false);
bool circle = false;
int maxLen = -1;
queue<pair<int, int>> q;
for (int i = 0; i < n; ++i) if (!deg[i]) q.emplace(i, 0);
while (!q.empty()) {
auto [fst, snd] = q.front();
q.pop();
if (fst == 0) maxLen = max(maxLen, snd);
vis[fst] = true;
for (int i = head[fst]; ~i; i = edge[i].n) {
--deg[edge[i].v];
if (!deg[edge[i].v]) q.emplace(edge[i].v, snd + 1);
}
}

if (deg[0]) circle = true;

cout << (circle || maxLen >= k ? "YES" : "NO") << endl;
}
}

D. Neutral Tonality

大致题意

两个数组,数组 $a$ 是固定顺序,数组 $b$ 可以按照任意顺序插入到 $a$ 数组中,使得整个数组的 LIS 最短

思路

这题应该才是 C 题,很简单,插入的顺序按照从大到小插入,每次插入的时候,插入到右边没有比当前值小的值处即可

AC code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void solve() {
int _;
cin >> _;
for (int ts = 0; ts < _; ++ts) {
int n, m;
cin >> n >> m;
vector<int> a(n), b(m), ma(n);
for (auto& i: a) cin >> i;
for (auto& i: b) cin >> i;
sort(b.begin(), b.end(), greater<>());
ma[n - 1] = a[n - 1];
for (int i = n - 2; i >= 0; --i) ma[i] = max(ma[i + 1], a[i]);
int j = 0;
for (int i = 0; i < n; ++i) {
while (j < m && b[j] >= ma[i]) cout << b[j++] << ' ';
cout << a[i] << ' ';
}
while (j < m) cout << b[j++] << ' ';
cout << endl;
}
}