My birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a numberN of them, of various tastes and of various sizes. F of my friends are coming to my party and each of them gets a piece of pie. This should be one piece…
一.题意 有一个手机,容量为$C$,网上有$N$个app,每个app有个安装包大小$d_i$,有个安装后的占用空间大小$s_i$,安装app是瞬间完成的,即app的占用空间可以瞬间由$d_i$变成$s_i$,而不需要其他多余的空间.问这个手机最多可以安装多少个app,输出最多可以安装的app数量和安装顺序. 二.思路 很显然的$dp$.按照$max(d,s)-s$从大到小排序.$dp[i][j]$表示在前$i$个app中,占用空间不超过$j$的条件下最多可以安装的app的数量.那么,有如下递推式…
ACM International Collegiate Programming Contest World Finals 2014 A - Baggage 题目描述:有\(2n\)个字符摆在编号为\(1\)~\(2n\)格子里,奇数位为\(B\),偶数位为\(A\),另外编号为\((-2n+1)\)~\(0\)的格子是空的,现在可以移动两个相邻的字符,移动到两个空的格子里,最终使得全部\(A\)在全部\(B\)的左边,而且字符都是连续的,但不必放回原位,输出最小步数的方案. solution…
ACM International Collegiate Programming Contest World Finals 2013 A - Self-Assembly 题目描述:给出\(n\)个正方形组件,正方形每条边有一个标签,标签可能是00,表示这条边不能与其它边相拼,也可能是一个字母加正号或负号,相同字母不同符号的边可以相拼.每个组件有无限个,问利用这些组件是否能拼出一个无限大的多边形. solution 拆点,每个正方形拆成\(4\)个点,每条边一个,然后每条边拆成两个点(出点和入点)…
ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2018) Syria, Lattakia, Tishreen University, April, 30, 2018 Problem A. Can Shahhoud Solve it? Problem B. Defeat the Monsters Problem C. UCL Game Night Problem…
ACM International Collegiate Programming Contest, Tishreen Collegiate Programming Contest (2017)- K. Poor Ramzi -dp+记忆化搜索 [Problem Description] 给你一串\(01\)字符串,将其划分,使得划分后,分别求出每组\(01\)之和后是回文的,求划分的方案数, [Solution] 定义\(dp[l][r]\)表示,区间\([l,r]\)中满足条件的方案数是多少.…
Solved A Gym 100712A Who Is The Winner Solved B Gym 100712B Rock-Paper-Scissors Solved C Gym 100712C Street Lamps Solved D Gym 100712D Alternating Strings Solved E Gym 100712E Epic Professor Solved F Gym 100712F Travelling Salesman Solved G Gym 10071…
Kuma Rider久违的第二场训练,这场很水,又在vj的榜单上看到第一场的大哥了,2小时ak,大哥牛啤! A.水 #include<cstdio> #include<iostream> #include<algorithm> #include<queue> #include<cstring> #include<string> #include<vector> #include<cmath> #include&…
F. Palindrome Problem Description A string is palindrome if it can be read the same way in either direction, for example "maram" is palindrome, while "ammar" is not. You are given a string of n characters, where each character is eithe…
F. Monkeying Around   维护点在多少个线段上 http://codeforces.com/gym/101350/problem/F 题意:有m个笑话,每个笑话的区间是[L, R],笑话种类有1e5,一开始所有猴子都在凳子上,听到一个笑话,就倒下,但是如果是听过的笑话,就重新回到凳子上.问最终有多少个猴子在凳子上. 相当于有1e5个线段,如果我们能知道第i个猴子,被多少个线段覆盖了,那么可以找出那些线段中的最后那一条,就是最后覆盖上去的那一条,那条线段是哪一个笑话,设为k,如果…