Codeforces 1345 D - Monopole Magnets】的更多相关文章

传送门:D. Monopole Magnets 这一场也是很神奇了,先是推迟三天,后是评测鸡崩了,unrated... 题意:每一行,每一列必须都要至少有一个s,n要可以到所有的黑格,n的上下左右如果有一个s,他就可以往那个方向移动一格,n最后不能在白格,求n最少的个数. 题解: 1.每一行每一列如果有#,#必须是连续的,否则输出-1 2.如果有一行没有#,那么至少有一列要没有#,s就可以放在交点处,否则输出-1. 3.求解连通块的个数 1 #include<bits/stdc++.h> 2…
C. Edo and Magnets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/594/problem/C Description Edo has got a collection of n refrigerator magnets! He decided to buy a refrigerator and hang the magnets on the door. The shop ca…
CodeForces - 344A id=46664" style="color:blue; text-decoration:none">Magnets Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Mad scientist Mike entertains himself by arranging ro…
link:http://codeforces.com/contest/344/problem/A 这道题目很简单. 把输入的01 和10 当做整数,如果相邻两个数字相等的话,那么就属于同一组,否则,就新增加了一组. #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int main(void) { #ifndef ONLINE_JUDGE freopen("…
Description Mad scientist Mike entertains himself by arranging rows of dominoes. He doesn't need dominoes, though: he uses rectangular magnets instead. Each magnet has two poles, positive (a "plus") and negative (a "minus"). If two mag…
Portal: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1345  http://codeforces.com/gym/100803/attachments  A题 好题! 坑不多,切入比较难 一开始的想法是暴力,由于求得是最小解且此图太大无边界,所以不能DFS,首先想到BFS 解法1 BFS+STL queue #include<iostream> #include<algorithm> #include&…
Codeforces Round #639 (Div. 2) (这场官方搞事,唉,just solve for fun...) A找规律 给定n*m个拼图块,每个拼图块三凸一凹,问能不能拼成 n * m的长方形 只要有某一维为1都可,只要无一维为1,只能是 2 * 2 B找规律,二分 搭金字塔 如图: 给定n,每次尽可能搭高的,问能搭几个金字塔 找规律,预处理,查询时二分 C数学,桶 换房子,下面就是换的规则(无非就是新房为k+Ak再对n取模) 模拟一下,桶存即可 D深搜 规则很多很复杂 原题地…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
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…