A.B.C(By musashiheart) 0216个人赛前三道题解 E(By ggg) Gym - 100735E Restore H(by pipixia) Gym - 100735H…
http://codeforces.com/gym/100739/problem/A 按位考虑,每一位建一个线段树. 求出前缀xor和,对前缀xor和建线段树. 线段树上维护区间内的0的个数和1的个数. 修改就修改p到最后的区间,进行区间取反. 回答询问时把总区间内0的个数和1的个数相乘即可. 时间复杂度\(O(n\log^2n)\). #include<cstdio> #include<cstring> #include<algorithm> using namesp…
I.Yet another A + B You are given three numbers. Is there a way to replace variables A, B and C with these numbers so the equality A + B = C is correct? Input There are three numbers X1, X2 and X3 (1 ≤ Xi ≤ 10100), each on a separate line of input. O…
G.LCS Revised   The longest common subsequence is a well known DP problem: given two strings A and B, one has to compute the maximum length of a subsequence that's common to both A and B. In this particular problem we work with strings A and B formed…
E - Restore Given a matrix A of size N * N. The rows are numbered from 0 to N-1, the columns are numbered from 0 to N-1. In this matrix, the sums of each row, the sums of each column, and the sum of the two diagonals are equal. For example, a matrix…
日常训练题解 D.Triangle Formation You are given N wooden sticks. Your task is to determine how many triangles can be made from the given sticks without breaking them. Each stick can be used in at most one triangle. Input The first line of each test case co…
2015 UESTC Winter Training #7 2010-2011 Petrozavodsk Winter Training Camp, Saratov State U Contest 据说这套题写出3题就是金牌水平了... Problem D. Group Stage 足球比赛,现在有n(2<= n <=100)支球队.要从中选拔m(1<= m <=n-1)支球队,每支球队互相比赛一场,即比赛n*(n-1)/2场,胜者得3分,平局各得1分.最后从大到小列出排名,如果有…
2015-2016 Petrozavodsk Winter Training Camp, Nizhny Novgorod SU Contest B. Forcefield 题意 给你一维平面上n个镜子,镜子的朝向有正面和背面,如果光束从正面穿过,会摧毁镜子,并且光束会反向:如果从背面穿过的话,什么都不会发生. 光束一开始从X位置,射向0点,然后你人在0点,会反射光束. 问你要破坏所有镜子,人需要反弹光束多少次. 数据范围100000 题解 其实模拟就好了,击破镜子的顺序就那么一种. 代码 #in…
Petrozavodsk Winter Training Camp 2018 Problem A. Mines 题目描述:有\(n\)个炸弹放在\(x\)轴上,第\(i\)个位置为\(p_i\),爆炸半径为\(r_i\),引爆第\(i\)个炸弹的花费为\(c_i\).但一个炸弹\(i\)爆炸时,在爆炸半径内的其它炸弹都会爆炸,而且不用花费.有\(Q\)个操作,每次改变一个炸弹的花费,然后输出引爆所有炸弹的最小费用. solution 不会. Problem B. Balls 题目描述:有\(n\…
2014-2015 Petrozavodsk Winter Training Camp, Contest.58 (Makoto rng_58 Soejima contest) Problem A. Manhattan solved by RDC 32 min 1Y 题意 给一网格图,找出欧几里得距离为 d 的两点,最大化最短路. 第一回合 三分搜索,第一个点的坐标 \((x,0)(0\leq x<1)\),确定第一个点后,对第二个点的横坐标或者纵坐标进行枚举计算答案. 第二回合 设最优解两点之间…