C. Package Delivery 题目连接: http://www.codeforces.com/contest/627/problem/C Description Johnny drives a truck and must deliver a package from his hometown to the district center. His hometown is located at point 0 on a number line, and the district cen…
暴力 A - Orchestra import java.io.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner cin = new Scanner (System.in); int r = cin.nextInt (); int c = cin.nextInt (); int n = cin.nextInt (); int k = cin.nextInt ();…
E - Preorder Test 思路:想到二分答案了之后就不难啦, 对于每个答案用树形dp取check, 如果二分的值是val, dp[ i ]表示 i 这棵子树答案不低于val的可以访问的 最多节点, 第二次dfs求出以每个点为根的答案. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int,…
A. Orchestra time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Paul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the ex…
Preorder Test 题目连接: http://www.codeforces.com/contest/627/problem/D Description For his computer science class, Jacob builds a model tree with sticks and balls containing n nodes in the shape of a tree. Jacob has spent ai minutes building the i-th ba…
D. Factory Repairs 题目连接: http://www.codeforces.com/contest/635/problem/D Description A factory produces thimbles in bulk. Typically, it can produce up to a thimbles a day. However, some of the machinery is defective, so it can currently only produce…
C. XOR Equation 题目连接: http://www.codeforces.com/contest/635/problem/C Description Two positive integers a and b have a sum of s and a bitwise XOR of x. How many possible values are there for the ordered pair (a, b)? Input The first line of the input…
B. sland Puzzle 题目连接: http://www.codeforces.com/contest/635/problem/B Description A remote island chain contains n islands, labeled 1 through n. Bidirectional bridges connect the islands to form a simple cycle - a bridge connects islands 1 and 2, isl…
A. Orchestra 题目连接: http://www.codeforces.com/contest/635/problem/A Description Paul is at the orchestra. The string section is arranged in an r × c rectangular grid and is filled with violinists with the exception of n violists. Paul really likes vio…
贪心.当前位置满油可达的gas station中,如果有比它小的,则加油至第一个比他小的.没有,则加满油,先到达这些station中最小的.注意数的范围即可. #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define LL long long using namespace std; const int MAXN = 200050; int d,…