跳至内容
璟雯院
珺璟如晔,雯华若锦
用户工具
登录
站点工具
搜索
工具
显示页面
修订记录
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您在这里:
start
»
icpc
»
problems
»
luogup5661
icpc:problems:luogup5661
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== 公交换乘 ====== ===== 想法 ===== 使用队列维护优惠券,并打是否使用过的标记。 ===== 代码实现 ===== <code c++> #include <cstdio> const int N = 1e5 + 10; int t[N], val[N], head = 0, last = -1; bool vis[N]; int main() { int n, type, ti, temp, ans = 0; scanf("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d %d %d", &type, &temp, &ti); while (head <= last && (ti - t[head] > 45 || vis[head])) head++; if (type) { bool flag = false; for (int t = head; t <= last; t++) if (val[t] >= temp && !vis[t]) { flag = true; vis[t] = true; break; } if (!flag) ans += temp; } else { ans += temp; last++; t[last] = ti; val[last] = temp; } } printf("%d", ans); return 0; } </code>
/app/www/public/data/pages/icpc/problems/luogup5661.txt
· 最后更改: 2024/03/27 02:33 由
温婕莺
页面工具
显示页面
修订记录
反向链接
回到顶部