暴力 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…
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…
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…