E. Paths and Trees time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving…
题目链接: 题目 E. Paths and Trees time limit per test 3 seconds memory limit per test 256 megabytes inputstandard input outputstandard output 问题描述 Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important…
E. Paths and Trees time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than solving…
题目传送门 /* 比C还水... */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream> using namespace std; typedef long long ll; ; const int INF = 0x3f3f3f3f; ll a[MAXN]; int main(void) //Codeforc…
题目传送门 /* 题意:每棵树给出坐标和高度,可以往左右倒,也可以不倒 问最多能砍到多少棵树 DP:dp[i][0/1/2] 表示到了第i棵树时,它倒左或右或不动能倒多少棵树 分情况讨论,若符合就取最大值更新,线性dp,自己做出来了:) */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream> using na…
题目传送门 /* 题意:找到一个字符串p,使得它和s,t的不同的总个数相同 贪心:假设p与s相同,奇偶变换赋值,当是偶数,则有答案 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream> using namespace std; ; const int INF = 0x3f3f3f3f; int p[MAXN…
题目传送门 /* 题意:5种情况对应对应第i或j辆车翻了没 水题:其实就看对角线的上半边就可以了,vis判断,可惜WA了一次 3: if both cars turned over during the collision. 是指i,j两辆车,而不是全部 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <iostream>…
A.Toy Cars 题意:给出n辆玩具车两两碰撞的结果,找出没有翻车过的玩具车. 思路:简单题.遍历即可. #include<iostream> #include<cstdio> using namespace std; ][]; ]; int main() { int n; scanf("%d", &n); ; i <= n; i++) { ; j <= n; j++) scanf("%d", *(mp + i) +…
题意 求一个生成树,使得任意点到源点的最短路等于原图中的最短路.再让这个生成树边权和最小. http://codeforces.com/contest/545/problem/E 思路 先Dijkstra一下,再对每个点连的边判断是不是最短路上的边,如果是那再贪心取最小的边即可. 代码 #include<bits/stdc++.h> using namespace std; #define ll long long const ll inf=1e18; const int N=6e5+5; s…
C. Woodcutters Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/545/problem/D Description Little girl Susie went shopping with her mom and she wondered how to improve service quality. There are n people in the queue. For ea…