TC SRM 584 DIV2】的更多相关文章

250pt: 水题set处理. 500pt: 题意: 给你一个图,每条边关联的两点为朋友,题目要求假设x的金钱为y,则他的左右的朋友当中的钱数z,取值为y - d <= z <= y + d.求使得任意两点的最大金钱差值,若果是inf输出-1. 思路:求任意两点的最短的的最大值即可,比赛时不知道哪地方写搓了,直接被系统样例给虐了,老师这么悲剧500有思路能写,老师不仔细哎.. floyd求任意两点的最短距离好写一些. #include <iostream> #include <…
第一次在DIV2 AK了. 250水题. 500,FLoyd搞出所有边的最短路,然后找最短路,中最长的,如果有不连通的边返回-1 1000,组合DP,各种慌乱,在最后1分钟时,交上了,感觉很棒,最后还A了.. dp[i][j]表示前i个堆里选j个人,每一个堆都有o[i]个人,枚举堆里,可以选多少个人. 第二题,写了将近半个小时...没太想好,到底是求最长路还是求最短路,边调边想,浪费些时间. 第三题,发现最近做组合问题,不是那么搓了... rating涨了131,进div1!! 1000的关键代…
AABB Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 TC Description One day, Jamie noticed that many English words only use the letters A and B. Examples of such words include "AB" (short for abdominal), "BAA" (the noise a sheep makes), &…
ChessFloor Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 TC Description Samantha is renovating a square room. The floor of the room is an N times N grid of unit square tiles. Each tile has some color. You are given the current colors of all tiles in a…
LuckyXorTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 TC Description A lucky number is a positive integer consisting of only the digits 4 and 7.Given an int a, return an int b strictly greater than a, such that a XOR b is a lucky number. (See Notes fo…
很棒的DP,不过没想出,看题解了..思维很重要. #include <iostream> #include <cstdio> #include <cstring> #include <vector> #include <cmath> #include <algorithm> using namespace std; ]; ]; class MayTheBestPetWin { public : int calc(vector <…
很不错的一题,非常巧妙的用DP顺序解决这个问题... 可以发现,只和A里面最小的有关系... #include <cstdio> #include <cstring> #include <queue> #include <string> #include <vector> #include <algorithm> using namespace std; #define LL long long *+]; vector<int&…
100的数据直接暴力就行,想多了... ac的代码: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <vector> #define LL __int64 +; using namespace std; int a[maxn]…
BearPlaysDiv2 Problem Statement    Limak is a little bear who loves to play. Today he is playing by moving some stones between three piles of stones. Initially, the piles contain A, B, and C stones, respectively. Limak's goal is to produce three equa…
 BearCheats Problem Statement    Limak is an old brown bear. Because of his bad eyesight he sometimes has to visit his doctor, Dr. Carrot. Today is one such day. Dr. Carrot has a blackboard in his office. There is a number A written on the blackboard…