codeforces 192 D】的更多相关文章

Link: Codeforces #192 传送门 前两天由于食物中毒现在还要每天挂一天的水 只好晚上回来随便找套题做做找找感觉了o(╯□╰)o A: 看到直接大力模拟了 但有一个更简便的方法,复杂度为$O(被禁止的格子数)$ 如果将每个黑格子上下左右四条线都染上色 可以发现一个格子最终无法被“净化”当且仅当其被左右/上下来向都染过色,所以将最终无法净化的格子合并是一个矩形 这样最终答案为:黑格子出现的行的个数*黑格子出现的列的个数 此时复杂度就变成与黑格子个数相关了 #include <bit…
link: http://codeforces.com/contest/330/problem/C broute force but you must be careful about some tricks and think about all the instances /* ID: zypz4571 LANG: C++ TASK: 192c.cpp */ #include <iostream> #include <cstdio> #include <cstdlib&g…
link: http://codeforces.com/contest/330/problem/D The discription looks so long, but the problem is simple if you can grasp the problem quickly. /* ID: zypz4571 LANG: C++ TASK: 192d.cpp */ #include <iostream> #include <cstdio> #include <cst…
This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contempted.The problem in Div2 was so...em,how to say,anyway I even daren't to believe.Yesterday I solved two fifths of problems.You see? I'm just a guy full…
C. Graph Reconstruction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/problem/C Description I have an undirected graph consisting of n nodes, numbered 1 through n. Each node has at most two incident edges. For each pa…
B. Biridian Forest Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/problem/B Description You're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go through t…
A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/problem/A Description You are an adventurer currently journeying inside an evil temple. After defeating a couple of weak zombies, you arrived at a square r…
D. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You're a mikemon breeder currently in the middle of your journey to become a mikemon master. Your current obstacle is go…
题意: 要在N个城市之间修建道路,使得任意两个城市都可以到达,而且不超过两条路,还有,有些城市之间是不能修建道路的. 思路: 要将N个城市全部相连,刚开始以为是最小生成树的问题,其实就是一道简单的题目.  要求两个城市之间不超过两条道路,那么所有的城市应该是连在一个点上的,至于这个点就很好找了,只要找到一个没有和其他点有道路限制的即可. //cf 192 B #include <stdio.h> #include <string.h> char map[1005][1005]; i…
题意: 如果某一行没有草莓,就可以吃掉这一行,某一列没有也可以吃点这一列,求最多会被吃掉多少块蛋糕. //cf 192 div2 #include <stdio.h> #include <string.h> int vis[11][11]; char map[11][11]; int main() { int r, c; while (scanf("%d %d", &r, &c) != EOF) { for (int i = 1; i <=…
吐槽一下,这次的CF好简单啊. 可是我为什么这么粗心这么大意这么弱.把心沉下来,想想你到底想做什么! A 题意:O(-1) 思路:O(-1) #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <cstring> using namespace std; int main() { ]; ][]; int n, m; while(c…
#include <iostream> #include <vector> using namespace std; int main(){ int r,c; cin >>r>>c; vector<bool> row(r,false),col(c,false); char ch; ; i < r; i ++ ){ ; j < c; j ++){ cin >> ch; if(ch == 'S') row[i] = col[j…
#include <iostream> #include <vector> using namespace std; int main(){ int n,m; cin >> n >> m; vector< ,false); ; i < m ; i ++ ){ int a,b; cin >> a>>b; flag[a]=flag[b]=true; } ; ; i <= n ; i ++ ){ if(!flag[i]){…
题意: 在一个正常的点可以净化该行该列的所有细胞,判断是否可以净化所有的细胞,并且输出所选的点. 思路: 如果可以的话,一定会选n个点. 先判断每一行是否有正常细胞,然后判断每一列是否有,如果都没有肯定不能净化,然后输出每一行或者每一列的第一个正常细胞的位置就好. #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int n ; char map[110][11…
A. Cakeminator time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For exam…
Codeforces A                     B                        C                             D                                   E                                  57 div2         比较简单的题!树状数组维护!             75 div1   简单题!排序~                               …
B. Radio Station time limit per test2 seconds memory limit per test256 megabytes Problem Dsecription As the guys fried the radio station facilities, the school principal gave them tasks as a punishment. Dustin's task was to add comments to nginx conf…
A. Eleven time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Eleven wants to choose a new name for herself. As a bunch of geeks, her friends suggested an algorithm to choose a name for her. El…
Codeforces 题面传送门 & 洛谷题面传送门 首先这个消消乐的顺着消的过程看起来有点难受,DP 起来有点困难.考虑对其进行一个转化:将所有出场的人按照攻击力从小到大合并,然后每次将两个攻击力为 \(l\) 的合并为一个攻击力为 \(l+1\) 的人,答案加上 \(c_{l+1}\),如果发现攻击力为 \(l\) 的人 \(\le 1\) 那就继续合并攻击力为 \(l+1\) 的人,不难发现这个过程与原题的过程等价. 接下来考虑如何 DP 求解原问题.我们将序列翻转,这样单调不减就可以转化…
Codeforces 题面传送门 & 洛谷题面传送门 Yet another immortal D1+D2 I %%%%%% 首先直接统计肯定是非常不容易的,不过注意到这个 \(k\) 非常小,因此考虑对这个 \(k\) 做点文章.我们考虑每个数被执行了多少次 \(-1\) 操作,设第 \(i\) 个数被执行了 \(b_i\) 次 \(-1\) 操作,那么最终的结果就是 \((a_1-b_1)\oplus(a_2-b_2)\oplus\cdots\oplus(a_n-b_n)\).然后就是比较神…
Codeforces 题目传送门 & 洛谷题目传送门 当被数据结构搞自闭的 tzc 信心满满地点开一道 *2400 的 dp 题时-- 却发现自己不会做?! 这足以证明蒟蒻 dp 之菜/dk/dk/wq/wq 设 \(a_i=[\text{第一个人会做第}\ i\ \text{题}]\),\(b_i=[\text{第二个人会做第}\ i\ \text{题}]\) 考虑 \(dp\),\(dp_{i,j,x,y}\) 表示现在已经考虑到了第 \(i\) 个人,现在已经消耗了 \(j\) 次偷看的机…
请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息. 异常详细信息: System.Net.Sockets.SocketException: 由于目标计算机积极拒绝,无法连接. 192.168.1.106:8078 可能是你的192.168.1.106:8078这个iis中的网站已经不存在了.…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
scp免密码登录:Linux基础 - scp免密码登陆进行远程文件同步 执行scp一直是OK的,某天在本地生成了公钥私钥后,scp到某个IP报以下错误 The authenticity of host '192.168.233.137 (192.168.233.137)' can't be established. ECDSA key fingerprint is SHA256:EsqTfeCJ34DnGV66REuRRPhoFwaLuee5wxFgEAZ8b9k. Are you sure y…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…
http://codeforces.com/problemset/problem/662/A 题目大意: 给定n(n <= 500000)张卡片,每张卡片的两个面都写有数字,每个面都有0.5的概率是在正面,各个卡牌独立.求把所有卡牌来玩Nim游戏,先手必胜的概率. (⊙o⊙)-由于本人只会在word文档里写公式,所以本博客是图片格式的. Code #include <cstdio> #include <cstring> #include <algorithm> u…
http://codeforces.com/problemset/problem/274/B 题目大意: 给定你一颗树,每个点上有权值. 现在你每次取出这颗树的一颗子树(即点集和边集均是原图的子集的连通图)且这颗树中必须包含节点1 然后将这颗子树中的所有点的点权+1或-1 求把所有点权全部变为0的最小次数(n<=10^5) 题解: 因为每一次的子树中都必须有1,所以我们得知每一次变换的话1的权值都会变化 所以我们以1为根 现在,我们发现,如果一个节点的权值发生变化,那么他的父节点的权值一定发生变…
http://codeforces.com/problemset/problem/261/B 题目大意:给定n个数a1-an(n<=50,ai<=50),随机打乱后,记Si=a1+a2+a3-+ai,问满足Si<=p的i的最大值的期望.(p<=50) (大意来自于http://www.cnblogs.com/liu-runda/p/6253569.html) 我们知道,全排列其实等价于我们一个一个地等概率地向一个序列里面插入数值 所以我们可以这么看这道题: 现在有n个数,有n个盒子…