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

推荐订阅源

F
Fortinet All Blogs
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Secure Thoughts
博客园 - 【当耐特】
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
博客园 - 司徒正美
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
P
Privacy & Cybersecurity Law Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
B
Blog
The GitHub Blog
The GitHub Blog
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
Martin Fowler
Martin Fowler
博客园 - 叶小钗
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tenable Blog
S
Securelist
博客园 - 三生石上(FineUI控件)
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
T
Threat Research - Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
Cloudbric
Cloudbric
The Cloudflare Blog
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Hacker News: Front Page
腾讯CDC
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
V2EX - 技术
V2EX - 技术
GbyAI
GbyAI
TaoSecurity Blog
TaoSecurity Blog
I
Intezer
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
Google Online Security Blog
Google Online Security Blog
T
The Blog of Author Tim Ferriss

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 个人备份的常用 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 一直无法启动 我的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 918 (Div. 4)
Shiroha · 2024-03-03 · via Shiroha白羽的博客

A. Odd One Out

大致题意

找出三个值中不同的那个

思路

把三个值异或一下就行了

AC code

1
2
3
4
5
6
7
8
9
void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int a, b, c;
cin >> a >> b >> c;
cout << (a ^ b ^ c) << endl;
}
}

B. Not Quite Latin Square

大致题意

有一个矩阵,每一行每一列由 ABC 组成,问缺少的那个是什么

思路

直接统计所有 ABC 数量,少的那个就是

AC code

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

C. Can I Square?

大致题意

给一个数组,问所有值加起来是否是一个平方数

思路

二分一下就行了

AC code

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

void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n;
cin >> n;
int sum = 0;
for (int i = 0; i < n; ++i) {
int tmp;
cin >> tmp;
sum += tmp;
}
int l = 1, r = 1e9 + 10;
while (l + 1 < r) {
if (const int mid = (l + r) >> 1; mid * mid <= sum) l = mid;
else r = mid;
}
cout << (l * l == sum ? "YES" : "NO") << endl;
}
}

D. Unnatural Language Processing

大致题意

已知一段话仅有 abcde 组成,且组成的每个单词都是“辅音+元音”或者“辅音+元音+辅音”的格式,要求分割一下字符串

思路

把所有元音前面那个作为开头就行了

AC code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n;
cin >> n;
string str;
str.reserve(n);
cin >> str;
cout << str[0];
for (int i = 1; i < n; ++i) {
if (i + 1 < n && (str[i + 1] == 'a' || str[i + 1] == 'e')) cout << '.';
cout << str[i];
}
cout << endl;
}
}

E. Romantic Glasses

大致题意

有一个原始数组,选取它的一段区间,这段区间内的偶数位和奇数位各自相加恰好相等,问是否存在

思路

把原始数组的奇数位置和偶数位置各自累加,做前缀和,然后再求差值,找是否存在差值相同的情况

AC code

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

void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n;
cin >> n;
vector<int> data(n);
for (auto& i: data) cin >> i;
int pre[2] = {};
map<int, int> mp;
++mp[0];
for (int i = 0; i < n; ++i) {
pre[i % 2] += data[i];
++mp[pre[1] - pre[0]];
}
bool flag = false;
for (auto [fst, snd]: mp) if (snd >= 2) flag = true;
cout << (flag ? "YES" : "NO") << endl;
}
}

F. Greetings

大致题意

每个人都从 $a_i$ 走到 $b_i$ 问是否会发生几次相撞

思路

对着 $a$ 排序后,对 $b$ 求逆序对即可

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
#define ll long long

void solve() {
int _;
cin >> _;
for (int tc = 0; tc < _; ++tc) {
int n;
cin >> n;
vector<pair<int, int>> data(n);
vector<int> b(n);
for (auto& [fst, snd]: data) cin >> fst >> snd;
for (int i = 0; i < n; ++i) b[i] = data[i].second;
sort(data.begin(), data.end());

function<ll(vector<int>&, vector<int>&, int, int)> mergeSort = [&](vector<int>& record, vector<int>& tmp, const int l, const int r) {
if (l >= r) return 0ll;
const int mid = (l + r) / 2;
ll inv_count = mergeSort(record, tmp, l, mid) + mergeSort(record, tmp, mid + 1, r);
int i = l, j = mid + 1, poss = l;
while (i <= mid && j <= r) {
if (record[i] <= record[j]) {
tmp[poss] = record[i];
++i;
inv_count += j - (mid + 1);
} else {
tmp[poss] = record[j];
++j;
}
++poss;
}
for (int ind = i; ind <= mid; ++ind) {
tmp[poss++] = record[ind];
inv_count += j - (mid + 1);
}
for (int ind = j; ind <= r; ++ind) {
tmp[poss++] = record[ind];
}
copy(tmp.begin() + l, tmp.begin() + r + 1, record.begin() + l);
return inv_count;
};

vector<int> record(n), tmp(n);
for (int i = 0; i < n; ++i) record[i] = data[i].second;
cout << mergeSort(record, tmp, 0, n - 1) << endl;
}
}

G. Bicycles

大致题意

每个城市都有不同速度的车,从 1 号城市出发,问走到 n 号城市需要多久

思路

计算到达每一个城市,且用 $i$ 辆车的情况下,最小费用是多少,然后在图上不断 bfs 即可

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
47
48
49
50
#define int long long

void solve() {
int _;
cin >> _;
// bool flag = false;
for (int tc = 0; tc < _; ++tc) {
int n, m;
cin >> n >> m;
vector<int> head(n + 1, -1), s(n + 1);
vector<tuple<int, int, int>> edges(m * 2);
for (int i = 0; i < m; ++i) {
int u, v, w;
cin >> u >> v >> w;
edges[i << 1] = {u, w, head[v]};
edges[i << 1 | 1] = {v, w, head[u]};
head[v] = i << 1;
head[u] = i << 1 | 1;
}
for (int i = 1; i <= n; ++i) cin >> s[i];

vector<vector<int>> last(n + 1);
for (auto &i: last) i.resize(n + 1, LONG_LONG_MAX);
last[1][1] = 0;
queue<int> q;
q.push(1);
while (!q.empty()) {
auto c = q.front();
q.pop();
int e = head[c];
while (~e) {
const auto& [to, w, next] = edges[e];
e = next;
bool flag = false;
for (int i = 1; i <= n; ++i) {
if (last[c][i] == LONG_LONG_MAX) continue;
if (const int nc = last[c][i] + w * s[i]; last[to][i] > nc) {
flag = true;
last[to][i] = nc;
last[to][to] = min(last[to][to], last[to][i]);
}
}
if (flag) q.push(to);
}
}
int ans = LONG_LONG_MAX;
for (int i = 1; i <= n; ++i) ans = min(ans, last[n][i]);
cout << ans << endl;
}
}