2025年2月26日大约 4 分钟
题目传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1010
题目大意
小狗要逃离一个的长方形迷宫,迷宫出口的门仅在第 秒时开一瞬间(不到1秒)。因此,小狗必须恰好在第 秒到达门口才能逃离。 每一秒,它可以向上下左右任意移动一格,且所有格子至多走一次。
2023年11月13日大约 3 分钟
题目传送门:https://www.luogu.com.cn/problem/P1807
解法一:拓扑排序
#include <bits/stdc++.h>
using i64 = long long;
using namespace std;
typedef pair<int, int> pii;
constexpr int N = 1505, M = 5e4 + 5;
// mt19937_64 rng(random_device{}());
int n, m;
int ver[M], edge[M], nxt[M], head[N], tot, in[N];
i64 d[N];
void add(int x, int y, int z) {
ver[++tot] = y, edge[tot] = z, nxt[tot] = head[x], head[x] = tot;
}
void topsort() {
queue<int> q;
for (int x = 2; x <= n; ++x) {
if (in[x] == 0) {
q.push(x);
}
}
while (!q.empty()) {
int x = q.front(); q.pop();
for (int i = head[x]; i ; i = nxt[i]) {
int y = ver[i];
if (--in[y] == 0) {
q.push(y);
}
}
}
d[1] = 0;
q.push(1);
while (!q.empty()) {
int x = q.front(); q.pop();
for (int i = head[x]; i ; i = nxt[i]) {
int y = ver[i], z = edge[i];
d[y] = max(d[y], d[x] + z);
if (--in[y] == 0) {
q.push(y);
}
}
}
}
const i64 inf = 1e18;
void solve() {
cin >> n >> m;
fill(d, d + 1 + n, -inf);
for (int i = 0; i < m; ++i) {
int x, y, z;
cin >> x >> y >> z;
add(x, y, z);
++in[y];
}
topsort();
cout << (d[n] ==-inf ? -1 : d[n]) << '\n';
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
ios::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
solve();
return 0;
}
2025年6月9日大约 2 分钟
Thread#sleep | Object#wait | LockSupport#park | |
---|---|---|---|
调用方式 | 抛出中断异常 | 必须在synchronized块中、抛出中断异常。如果当前线程不是对象锁的拥有者,调用wait/notify会抛出 IllegalMonitorStateException 异常 | 无限制,无抛出 |
阻塞时是否释放当前线程占有的锁 | 不释放 | 释放 | 不释放 |
传入参数 | 必须传入时间 | 可选传入超时时间 | 可选传入超时时间、阻塞原因blocker |
唤醒方式 | 无法从外部唤醒 | Object#notify,还需抢锁成功。wait前调用notify无效 | LockSupport#unpark,唤醒传入的执行线程。park前调用unpark有效 |
中断响应 | 抛出中断异常,清除中断标志位 | 抛出中断异常,清除中断标志位 | park方法返回,不抛异常,中断响应位依然为true |
底层实现 | native方法Thread#sleep0 | native方法Object#wait0 | 调用Unsafe#park。类似只有一个许可证的Semaphore,且重复执行最多获得一个许可证 |
2025年4月28日小于 1 分钟
题目传送门:https://www.luogu.com.cn/problem/P1462
第一感觉跟leetcode做过的这道题很像,于是采用启发式搜索,取h(x) 恒等于0,很显然启发函数是可接受的、一致的,即Dijkstra。
2025年4月22日大约 3 分钟
2025年4月21日小于 1 分钟
论文来自 IEEE Conference on Computer Communications(INFOCOM 2019)的《CFHider: Control Flow Obfuscation with Intel SGX》。

2025年4月15日大约 36 分钟
论文来自 IEEE 12th Working Conference on Reverse Engineering (WCRE 2005)的《Deobfuscation: Reverse Engineering Obfuscated Code》。

2025年4月14日大约 31 分钟
论文来自 IEEE International Conference on Dependable Systems and Networks 2001(DSN2001)的《Protection of software-based survivability mechanisms》。

2025年4月14日大约 32 分钟