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

推荐订阅源

大猫的无限游戏
大猫的无限游戏
博客园 - 【当耐特】
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
爱范儿
爱范儿
The Cloudflare Blog
腾讯CDC
Security Archives - TechRepublic
Security Archives - TechRepublic
TaoSecurity Blog
TaoSecurity Blog
云风的 BLOG
云风的 BLOG
Recent Announcements
Recent Announcements
C
Check Point Blog
Schneier on Security
Schneier on Security
S
Schneier on Security
J
Java Code Geeks
B
Blog RSS Feed
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
Stack Overflow Blog
Stack Overflow Blog
博客园_首页
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
A
About on SuperTechFans
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Google DeepMind News
Google DeepMind News
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
A
Arctic Wolf
S
Secure Thoughts
P
Palo Alto Networks Blog
The Last Watchdog
The Last Watchdog
SecWiki News
SecWiki News
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 三生石上(FineUI控件)
D
Darknet – Hacking Tools, Hacker News & Cyber Security
量子位
U
Unit 42
I
InfoQ
D
DataBreaches.Net
P
Privacy International News Feed
T
Troy Hunt's Blog
博客园 - 叶小钗
T
Threatpost
博客园 - Franky
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
www.infosecurity-magazine.com
www.infosecurity-magazine.com
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
C
Cisco Blogs

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
HDU2883 kebab——最大流
Shiroha · 2019-07-11 · via Shiroha白羽的博客

设置超级源点为 0
顾客点范围为 1 - 204
时间点 205 - 610
超级汇点 615
超级源点与所有顾客连线,容量为需求的烤肉数 * 需求的每块烤肉的时间(即此顾客需要占用的总时间粒子)
顾客与时间点进行连线,仅当此时间点在顾客等待的时间段内,容量为INF
每个时间点与汇点连线,容量为 m

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#include <bits/stdc++.h>

using namespace std;

/*
* 最大流 SAP 算法,用 GAP 优化后
* 先把流量限制赋值到 maps 数组
* 然后调用 SAP 函数求解
* 可选:导出路径
*/

#define MAXN 620

int maps[MAXN][MAXN]; // 存图
int pre[MAXN]; // 记录当前点的前驱
int level[MAXN]; // 记录距离标号
int gap[MAXN]; // gap常数优化

// vector<int> roads[MAXN]; // 导出的路径(逆序)
// int curRoads; // 导出的路径数

// 入口参数vs源点,vt汇点
int SAP(int vs, int vt) {
memset(pre, -1, sizeof(pre));
memset(level, 0, sizeof(level));
memset(gap, 0, sizeof(gap));
gap[0] = vt;
int v, u = pre[vs] = vs, maxflow = 0, aug = INT_MAX;
// curRoads = 0;
while (level[vs] < vt) {
// 寻找可行弧
for (v = 1; v <= vt; v++) {
if (maps[u][v] > 0 && level[u] == level[v] + 1) {
break;
}
}
if (v <= vt) {
pre[v] = u;
u = v;
if (v == vt) {
// int neck = 0; // Dnic 多路增广优化,下次增广时,从瓶颈边(后面)开始
aug = INT_MAX;
// 寻找当前找到的一条路径上的最大流 (瓶颈边)
for (int i = v; i != vs; i = pre[i]) {
// roads[curRoads].push_back(i); // 导出路径——可选
if (aug > maps[pre[i]][i]) {
aug = maps[pre[i]][i];
// neck = i; // Dnic 多路增广优化,下次增广时,从瓶颈边(后面)开始
}
}
// roads[curRoads++].push_back(vs); // 导出路径——可选
maxflow += aug;
// 更新残留网络
for (int i = v; i != vs; i = pre[i]) {
maps[pre[i]][i] -= aug;
maps[i][pre[i]] += aug;
}
// 从源点开始继续搜
u = vs;
// u = neck; // Dnic 多路增广优化,下次增广时,从瓶颈边(后面)开始
}
} else {
// 找不到可行弧
int minlevel = vt;
// 寻找与当前点相连接的点中最小的距离标号
for (v = 1; v <= vt; v++) {
if (maps[u][v] > 0 && minlevel > level[v]) {
minlevel = level[v];
}
}
gap[level[u]]--; // (更新gap数组)当前标号的数目减1;
if (gap[level[u]] == 0)
break; // 出现断层
level[u] = minlevel + 1;
gap[level[u]]++;
u = pre[u];
}
}
return maxflow;
}

// 超级源点 0
// 顾客点 1 - 204
// 时间点 205 - 610
// 超级汇点 615
int n, m;
const int MaxPeople = 210;
const int Ed = 615;
struct costman {
int b, e, need, time;
};
set<int> timelist;
costman costmanlist[MaxPeople];

void init() {
memset(maps, 0, sizeof(maps));
set<int>::iterator iterl = timelist.begin();
set<int>::iterator iterr = timelist.begin();
iterr++;
int curiter = 0;
for (size_t i = 0; i < n; i++) {
maps[0][i + 1] = costmanlist[i].need * costmanlist[i].time;
}
while (iterr != timelist.end()) {
maps[205 + curiter][Ed] = ((*iterr) - (*iterl)) * m;
for (size_t i = 0; i < n; i++) {
if (costmanlist[i].b <= *iterl && costmanlist[i].e >= *iterr) {
maps[i + 1][curiter + 205] = INT_MAX;
}
}
iterl++;
iterr++;
curiter++;
}
}

int main() {
#ifdef ACM_LOCAL
freopen("./in.txt", "r", stdin);
freopen("./out.txt", "w", stdout);
#endif
ios::sync_with_stdio(false);
while (cin >> n >> m) {
timelist.clear();
long long sum = 0;
for (size_t i = 0; i < n; i++) {
cin >> costmanlist[i].b >> costmanlist[i].need >> costmanlist[i].e >> costmanlist[i].time;
sum += costmanlist[i].need * costmanlist[i].time;
timelist.insert(costmanlist[i].b);
timelist.insert(costmanlist[i].e);
}
init();
cout << (sum == SAP(0, Ed) ? "Yes" : "No") << endl;
}
return 0;
}