CF Playrix Codescapes Cup Problems Analysis】的更多相关文章

A 理清思路模拟 B 先对3个array排序,然后每次从某个array的头删数,可保证每个数必被处理1次,O(n log n) (set维护也行) C 分3类情况讨论,一种为: p1≤p2 && p1 + p2≤c,先排序维护前缀与Pre2(根据下标的prefix),枚举p2,剩余c-p2, 若p2*2>c,p1为prefix[c-p2]:若p2*2<=c,p1=Pre2[i-1] 还有一种tourist的写法:只根据下标维护prefix,对于p2,找到最大的p1(p1+p2&…
A. Carrot Cakes time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are ready at the same moment t minut…
D. Field expansion time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy…
我从来没想过自己可以被支配的这么惨,大神讲这个场不容易掉分的啊 A. Carrot Cakes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In some game by Playrix it takes t minutes for an oven to bake k carrot cakes, all cakes are…
E - Aquarium decoration 枚举两个人都喜欢的个数,就能得到单个喜欢的个数,然后用平衡树维护前k大的和. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PII pair<int, int> #define PLI pair<LL, int> #define ull unsigned…
题目链接:http://codeforces.com/contest/799/problem/C 题目: 题意: 给你n种喷泉的价格和漂亮值,这n种喷泉题目指定用钻石或现金支付(分别用D和C表示),C和D之间不能相互转换.你现在需要修建两个喷泉,给你硬币数和现金数,问你怎样才能使修建的两个喷泉的总漂亮值最大. 思路: 易知,要修建的两个喷泉如果一个是用钻石支付,另一个用现金支付,那么只需找到小于给的钻石和现金的上限的漂亮值最大的两个温泉相加,此处遍历一边即可.对于这两个温泉都用同一种支付方式的情…
显然将扩张按从大到小排序之后,只有不超过前34个有效. d[i][j]表示使用前i个扩张,当length为j时,所能得到的最大的width是多少. 然后用二重循环更新即可, d[i][j*A[i]]=max(d[i][j*A[i]],d[i-1][j]); d[i][j]=max(d[i][j],d[i-1][j]*A[i]); 当某次更新时,检验其符合了答案的条件,就输出. 显然可以用滚动数组优化到空间为线性. 注意爆int的问题. 此外,瞎几把搜+花式剪枝也能过. #include<cstd…
分几种情况讨论: (1)仅用C或D买两个 ①买两个代价相同的(实际不同)(排个序) ②买两个代价不同的(因为买两个代价相同的情况已经考虑过了,所以此时对于同一个代价,只需要保存美丽度最高的喷泉即可)(预处理b[i],表示代价小于等于i的物品中,美丽度最大的是多少.为了防止重复购买,枚举其中一个,然后另一个只买代价小于其代价的物品.) (2)用C和D各买一个 按这几种情况分类,可以比较好地避免买到同一个喷泉的情况. #include<cstdio> #include<algorithm&g…
题目传送门:http://codeforces.com/contest/799/problem/C C. Fountains time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output   Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. T…
C. Fountains time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain it…
CF [题意]:圆形球场有n个门,Allen想要进去看比赛.Allen采取以下方案进入球场:开始Allen站在第一个门,如果当前门前面有人Allen会花费单位时间走到下一个门,如果没人Allen从这个门就进去了.球场的每个门,每单位时间可以进去一个人.问Allen最终是从哪个门进入球场的? [分析]:我们可以发现是有规律的.我们假设第i个门有a个人,Allen第x圈可以从此进入,那么有:x∗n+i=a→x=abs(a−i)/n,所以第一个最小圈数进入的那个门就是答案. [代码]: #includ…
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems analysis and upsolves problems. But…
A. Dasha and Stairs Problems: 一个按照1,2,3……编号的楼梯,给定踩过的编号为奇数奇数和偶数的楼梯数量a和b,问是否可以有区间[l, r]符合奇数编号有a个,偶数编号有b个. Analysis: cj: 纸张的我=.= 经过Return改正,才发现没有主义a = b = 0的情况. #define PRON "a" #include <cstdio> #include <cstring> #include <vector&g…
Description Nikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems analysis and upsolves problems. But the point is that he had participated in such…
I find it may cost me so much time in doing such solutions to exercises and problems....I am sorry that I could not be persistent in doing it...Wish I could just recover it later on. [Bhatia.Matrix Analysis.Solutions to Exercises and Problems]PrI.6.1…
Mean Requests time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output In this problem you will have to deal with a real algorithm that is used in the VK social network. As in any other company tha…
Let $x,y,z$ be linearly independent vectors in $\scrH$. Find a necessary and sufficient condition that a vector $w$ mush satisfy in order that the bilinear functional $$\bex F(u,v)=\sef{x,u}\sef{y,v}+\sef{z,u}\sef{w,v} \eex$$ is elementary. Solution.…
For every matrix $A$, the matrix $$\bex \sex{\ba{cc} I&A\\ 0&I \ea} \eex$$ is invertible and its inverse is $$\bex \sex{\ba{cc} I&-A\\ 0&I \ea}. \eex$$ Use this to show that if $A,B$ are any two $n\times n$ matrices, then $$\bex \sex{\ba{c…
Let $A=A_1\oplus A_2$. Show that (1). $W(A)$ is the convex hull of $W(A_1)$ and $W(A_2)$; i.e., the smallest convex set containing $W(A_1)\cup W(A_2)$. (2). $$\beex \bea \sen{A}&=\max\sed{\sen{A_1},\sen{A_2}},\\ \spr(A)&=\max\sed{\spr(A_1),\spr(A_…
B. Problems for Round 题目连接: http://www.codeforces.com/contest/673/problem/B Description There are n problems prepared for the next Codeforces round. They are arranged in ascending order by their difficulty, and no two problems have the same difficult…
A. Jumping Ball time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In a new version of the famous Pinball game, one of the most important parts of the game field is a sequence of n bumpers. T…
Name Quest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A Martian boy is named s — he has got this name quite recently from his parents for his coming of age birthday. Now he enjoys loo…
Given a basis $U=(u_1,\cdots,u_n)$ not necessarily orthonormal, in $\scrH$, how would you compute the biorthogonal basis $\sex{v_1,\cdots,v_n}$? Find a formula that expresses $\sef{v_j,x}$ for each $x\in\scrH$ and $j=1,\cdots,k$ in terms of Gram matr…
Every $k\times k$ positive matrix $A=(a_{ij})$ can be realised as a Gram matrix, i.e., vectors $x_j$, $1\leq j\leq k$, can be found so that $a_{ij}=\sef{x_i,x_j}$ for all $i,j$. Solution. By Exercise I.2.2, $A=B^*B$ for some $B$. Let $$\bex B=(x_1,\c…
(Schur's Theorem) If $A$ is positive, then $$\bex \per(A)\geq \det A. \eex$$ Solution. By Exercise I.2.2, $A=T^*T$ for some upper triangular $T$ with non-negative diagonals. Thus $$\beex \bea \det A&=\det T^*\cdot \det T\\ &=\per T^*\cdot \per T\\…
Prove that for any matrices $A,B$ we have $$\bex |\per (AB)|^2\leq \per (AA^*)\cdot \per (B^*B). \eex$$ (The corresponding relation for determinants is an easy equality.) Solution. Let $$\bex A=\sex{\ba{cc} \al_1\\ \vdots\\ \al_n \ea},\quad B=\sex{\b…
Prove that for any vectors $$\bex u_1,\cdots,u_k,\quad v_1,\cdots,v_k, \eex$$ we have $$\bex |\det(\sef{u_i,v_j})|^2 \leq \det\sex{\sef{u_i,u_j}}\cdot \det \sex{\sef{v_i,v_j}}, \eex$$ $$\bex |\per(\sef{u_i,v_j})|^2 \leq \per\sex{\sef{u_i,u_j}}\cdot \…
Let $A$ be a nilpotent operator. Show how to obtain, from aJordan basis for $A$, aJordan basis of $\wedge^2A$. Solution. Since $A$ is nilpotent, each eigenvalue of $A$ is zero, and thus there exists an basis $e_1,\cdot,e_n$ of $\scrH$ such that $$\be…
Show that the inner product $$\bex \sef{x_1\vee \cdots \vee x_k,y_1\vee \cdots\vee y_k} \eex$$ is equal to the permanent of the $k\times k$ matrix $\sex{\sef{x_i,y_j}}$. Solution. $$\beex \bea &\quad \sef{x_1\vee \cdots \vee x_k,y_1\vee \cdots \vee y…
If $\dim \scrH=3$, then $\dim \otimes^3\scrH =27$, $\dim \wedge^3\scrH =1$ and $\dim \vee^3\scrH =10$. In terms of an orthonormal basis of $\scrH$, write an element of $(\wedge^3\scrH )\oplus \vee^3\scrH)^\perp$. Solution. Let $e_1,e_2,e_3$ be an ort…