CodeForces 148B Escape】的更多相关文章

Escape Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 148B Description The princess is going to escape the dragon's cave, and she needs to plan it carefully. The princess runs at vp mil…
题目链接:http://codeforces.com/problemset/problem/148/B 题意:公主从龙的洞穴中逃跑,公主的速度为vp,龙的速度为vd,在公主逃跑时间t时,龙发现公主逃跑并开始追公主.公主每丢弃一块宝石,龙需要花f小时整理并送回洞穴,然后再去追公主,公主在离洞穴距离为c的时候就安全了,求公主在逃跑过程中需要丢弃的宝石数 #include <stdio.h> #include <string.h> #include <iostream> #i…
目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定一个 n 个点的树(标号1~n),以结点 1 为根.每个结点有两个点权 ai 与 bi. 你可以从一个点出发跳到它的子树中的某个结点去(不能跳到自己). 从 x 跳到 y 所花费的代价为 ax * by,跳跃的总代价为每次跳跃的代价之和. 对于每个结点,计算从它出发跳到某一叶子结点的最小代价和. Input 第一行包含一个整数 n (2 ≤ n ≤ 10^5…
CodeForces 148B 一道简单模拟,判断龙能够抓到公主几次,如果公主和龙同时到达公主的城堡,不算龙抓住她,因为路程除以速度可能会产生浮点数,所以这里考虑一下精度问题 #include <iostream> #include <cstdio> #include <cstring> #include <iomanip> #include <algorithm> using namespace std; #define eps 1e-19 i…
题目传送门 /* 水题:这题唯一要注意的是要用double,princess可能在一个小时之内被dragon赶上 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> #include <map> using namespace std; ; const int INF = 0x3f3f3f3f;…
F. Escape Through Leaf time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tree with n nodes (numbered from 1 to n) rooted at node 1. Also, each node has two values associated…
听说正解是啥 set启发式合并+维护凸包+二分 根本不会啊 , 只会 李超线段树合并 啦 ... 题意 给你一颗有 \(n\) 个点的树 , 每个节点有两个权值 \(a_i, b_i\) . 从 \(u\) 跳到 \(v\) 的代价是 \(a_u \times b_v\) . 你需要计算每个节点跳到叶子的最小代价 . \((n \le 10^5, -10^5 \le a_i, b_i \le 10^5)\) 题解 我们首先考虑一个很容易的 \(dp\) , 令 \(dp_i\) 为 \(i\)…
题目链接:http://codeforces.com/contest/776/problem/D D. The Door Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Moriarty has trapped n people in n distinct rooms in a hotel. Some room…
题目链接: http://codeforces.com/problemset/problem/507/E E. Breaking Good time limit per test2 secondsmemory limit per test256 megabytes 问题描述 Breaking Good is a new video game which a lot of gamers want to have. There is a certain level in the game that…
[CCPC2019秦皇岛E] Escape Link https://codeforces.com/gym/102361/problem/E Solution 观察到性质若干然后建图跑最大流即可. 我的 ISAP 被卡了,换成 Dinic 却过了. #include <bits/stdc++.h> using namespace std; const int maxn = 200005; const int inf = 1e+9; #define reset(x) memset(x,0,siz…