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…
暴力 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…
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…
http://codeforces.com/contest/760/problem/E 题目大意:现在对栈有m个操作,但是顺序是乱的,现在每输入一个操作要求你输出当前的栈顶, 注意,已有操作要按它们的时间顺序进行. 思路:线段树好题啊啊,我们把push当成+1, pop当成-1,按操作的位置建立线段树,那么如何 寻找栈顶呢,我们计算每个点的后缀,栈顶就是下标最大的>0的后缀,我们拿后缀建立线段树, 剩下的就是区间加减法,和求区间最大值啦. #include<bits/stdc++.h>…
D - Travel Card 思路:dp,类似于单调队列优化. 其实可以写的更简单... #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define pii pair<int, int> using namespace std; ; ; const int inf = 0x3f3f3f3f; const LL INF = 0…
A. Petr and a calendar time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to wee…