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

推荐订阅源

B
Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
B
Blog RSS Feed
云风的 BLOG
云风的 BLOG
G
Google Developers Blog
Recent Announcements
Recent Announcements
A
About on SuperTechFans
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
Google DeepMind News
Google DeepMind News
S
Schneier on Security
S
Secure Thoughts
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
P
Proofpoint News Feed
Security Latest
Security Latest
Jina AI
Jina AI
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Recorded Future
Recorded Future
T
Tor Project blog
有赞技术团队
有赞技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News | PayPal Newsroom
博客园 - 三生石上(FineUI控件)
MyScale Blog
MyScale Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
Forbes - Security
Forbes - Security
D
DataBreaches.Net
人人都是产品经理
人人都是产品经理
NISL@THU
NISL@THU
C
Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google DeepMind News
Google DeepMind News
Project Zero
Project Zero
IT之家
IT之家
T
Threatpost
Cyberwarzone
Cyberwarzone
O
OpenAI News
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
J
Java Code Geeks
P
Proofpoint News Feed
The Last Watchdog
The Last Watchdog
月光博客
月光博客
Latest news
Latest news
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research

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 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 一直无法启动 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 928 (Div. 4)
Shiroha · 2024-04-20 · via Shiroha白羽的博客

A. Vlad and the Best of Five

大致题意

给出五个字母,其中只有 A/B,问那个字母出现次数多

思路

简单题,统计一下就行

AC code

1
2
3
4
5
6
7
8
9
10
11
12
void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
string str;
str.resize(5);
cin >> str;
int cnt[2] = {};
for (auto &i: str) ++cnt[i - 'A'];
cout << (cnt[0] > cnt[1] ? 'A' : 'B') << endl;
}
}

B. Vlad and Shapes

大致题意

检查一个图案是不是正方形还是三角形

思路

三角形不好检查,检查正方形就行,即四个角落都是染色的即可

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 tc = 0; tc < _; ++tc) {
int n;
cin >> n;
vector<string> data(n);
for (auto &i: data) i.resize(n), cin >> i;
int d[4] = {0, n, 0, n};
for (int i = 0; i < n; ++i) for (int j = 0; j < n; ++j) {
if (data[i][j] == '0') continue;
d[0] = max(d[0], i);
d[1] = min(d[1], i);
d[2] = max(d[2], j);
d[3] = min(d[3], j);
}
if (data[d[0]][d[2]] == '1' && data[d[1]][d[2]] == '1' && data[d[0]][d[3]] == '1' && data[d[1]][d[3]] == '1')
cout << "SQUARE" << endl;
else cout << "TRIANGLE" << endl;
}
}

C. Vlad and a Sum of Sum of Digits

大致题意

计算 $1, n$ 之间的所有值,将其的每一个 10 进制的值相加后再相加得到的结果

思路

暴力即可,注意打表

AC code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using namespace std;

void solve() {
vector<int> data(2e5 + 10, 0);
for (int i = 1; i < data.size(); ++i) {
data[i] = data[i - 1];
int t = i;
while (t) {
data[i] += t % 10;
t /= 10;
}
}

int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n;
cin >> n;
cout << data[n] << endl;
}
}

D. Vlad and Division

大致题意

给出 $n$ 个值,将其变成多个组,满足任意一个组内的任意两个值,满足他们两个值的任意比特位都不一样

思路

每个组里最多两个值,即必须是 $a_i ^ a_j = 0x7fffffff$

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
using namespace std;

void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n;
cin >> n;
map<int, int> st;
for (int i = 0; i < n; ++i) {
int tmp;
cin >> tmp;
++st[tmp];
}

int ans = 0;
while (!st.empty()) {
auto iter = st.begin();
int a = iter->first;
if (iter->second == 1) st.erase(iter);
else --iter->second;

int b = (~a) ^ (1 << 31);
iter = st.find(b);
if (iter != st.end()) --iter->second;
if (iter != st.end() && iter->second == 0) st.erase(iter);
++ans;
}

cout << ans << endl;
}
}

E. Vlad and an Odd Ordering

大致题意

有 $1, 2, 3, \dots, n$ 个数,先从小到大取出所有的奇数排成一排,
然后再取出剩下值中的,满足是一个奇数乘上一个 $2$ 的值,从小到大排成一排
然后再取出剩下值中的,满足是一个奇数乘上一个 $3$ 的值,从小到大排成一排

依此类推,直到用完,问第 $k$ 个值是多少

思路

实际上没有 $3$ 的机会了,同样的也没有 $5$ 的机会了

其实就是二进制里,把最后一位是 $1$ 的取走,然后取倒数第二位是 $1$ 的,依此类推

AC code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n, k;
cin >> n >> k;
int s = 1;
while (true) {
int t = (n + 1) / 2;
if (k <= t) {
break;
}
k -= t;
n -= t;
s <<= 1;
}
cout << (k * 2 - 1) * s << endl;
}
}

F. Vlad and Avoiding X

大致题意

一个 $7 \times 7 的矩阵,开始的时候一些方格已经被染成黑色,要让中间不出现 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
void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
vector<string> data(7);
for (auto &i: data) i.resize(7);
for (auto &i: data) cin >> i;
constexpr int arr[3][2] = {0, 0, 1, -1, 1, 1};
int ans = 49;
function<void(int)> dfs = [&](int s) {
if (s >= ans) return;
for (int i = 1; i < 6; ++i) for (int j = 1; j < 6; ++j)
if (data[i - 1][j - 1] == 'B' && data[i - 1][j + 1] == 'B' &&
data[i + 1][j - 1] == 'B' && data[i + 1][j + 1] == 'B' && data[i][j] == 'B') {
for (auto &ar: arr) {
data[i + ar[0]][j + ar[1]] = 'W';
dfs(s + 1);
data[i + ar[0]][j + ar[1]] = 'B';
}
return;
}
ans = min(ans, s);
};

dfs(0);
cout << ans << endl;
}
}

G. Vlad and Trouble at MIT

大致题意

有一棵树,有些节点上的人要播放音乐,有一些节点上的人要睡觉,有一些则无所谓

现在需要创建一些墙使得放英语的人不会吵到睡觉的人,音乐会随着树的边传播,墙只能创建在边上,问最少需要多少个墙

思路

树上搜索即可,如果当前节点是要播放音乐的,那么和它的所有要播放音乐或者无所谓的节点都可以连在一块,反之也一样。
但是如果是无所谓的人,那么就要看它的直接孩子节点中要播放音乐的多还是要睡觉的多了

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
46
void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n;
cin >> n;
vector<vector<int>> g(n);
string str;
str.resize(n);
for (int i = 1; i < n; ++i) {
int tmp;
cin >> tmp;
g[tmp - 1].push_back(i);
}
cin >> str;

int ans = n - 1;
function<int(int)> dfs = [&](int c) {
if (g[c].empty()) {
return str[c] == 'P' ? 1 : (str[c] == 'C' ? 2 : 0);
}
int cnt[3] = {};
for (const auto &n: g[c]) ++cnt[dfs(n)];
if (str[c] == 'P') {
ans -= cnt[1] + cnt[2];
return 1;
} else if (str[c] == 'S') {
ans -= cnt[0] + cnt[2];
return 0;
} else {
if (cnt[0] > cnt[1]) {
ans -= cnt[0] + cnt[2];
return 0;
} else if (cnt[1] > cnt[0]) {
ans -= cnt[1] + cnt[2];
return 1;
} else {
ans -= cnt[0] + cnt[2];
return 2;
}
}
};
dfs(0);
cout << ans << endl;
}
}