ural 1221. Malevich Strikes Back!
1221. Malevich Strikes Back!
Memory limit: 64 MB
Input
Output
Sample
input | output |
---|---|
|
|
Problem Source: The Seventh Ural State University collegiate programming contest
- #include <cstdio>
- #include <cstring>
- #include <cstdlib>
- #include <cmath>
- #include <deque>
- #include <vector>
- #include <queue>
- #include <iostream>
- #include <algorithm>
- #include <map>
- #include <set>
- #include <ctime>
- using namespace std;
- typedef long long LL;
- typedef double DB;
- #define For(i, s, t) for(int i = (s); i <= (t); i++)
- #define Ford(i, s, t) for(int i = (s); i >= (t); i--)
- #define Rep(i, t) for(int i = (0); i < (t); i++)
- #define Repn(i, t) for(int i = ((t)-1); i >= (0); i--)
- #define rep(i, x, t) for(int i = (x); i < (t); i++)
- #define MIT (2147483647)
- #define INF (1000000001)
- #define MLL (1000000000000000001LL)
- #define sz(x) ((int) (x).size())
- #define clr(x, y) memset(x, y, sizeof(x))
- #define puf push_front
- #define pub push_back
- #define pof pop_front
- #define pob pop_back
- #define ft first
- #define sd second
- #define mk make_pair
- inline void SetIO(string Name) {
- string Input = Name+".in",
- Output = Name+".out";
- freopen(Input.c_str(), "r", stdin),
- freopen(Output.c_str(), "w", stdout);
- }
- inline int Getint() {
- int Ret = ;
- char Ch = ' ';
- while(!(Ch >= '' && Ch <= '')) Ch = getchar();
- while(Ch >= '' && Ch <= '') {
- Ret = Ret*+Ch-'';
- Ch = getchar();
- }
- return Ret;
- }
- const int N = ;
- int n, Map[N][N];
- inline void Solve();
- inline void Input() {
- while(~scanf("%d", &n) && n) {
- For(i, , n)
- For(j, , n) scanf("%d", &Map[i][j]);
- Solve();
- }
- }
- inline bool Check(int x, int y, int r) {
- r /= ;
- if(x-r < || x +r > n || y-r < || y+r > n) return ;
- For(j, y-r, y+r) {
- For(i, x-r, x-r+abs(j-y)-)
- if(!Map[i][j]) return ;
- For(i, x+r-abs(j-y)+, x+r)
- if(!Map[i][j]) return ;
- For(i, x-r+abs(j-y), x+r-abs(j-y))
- if(Map[i][j]) return ;
- }
- return ;
- }
- inline void Solve() {
- int m = n;
- bool Flag = ;
- if(!(m&)) m--;
- while(m >= ) {
- For(i, , n) {
- For(j, , n)
- if(!Map[i][j] && Check(i, j, m)) {
- Flag = ;
- break;
- }
- if(Flag) break;
- }
- if(Flag) break;
- m -= ;
- }
- if(Flag) printf("%d\n", m);
- else puts("No solution");
- }
- int main() {
- #ifndef ONLINE_JUDGE
- SetIO("E");
- #endif
- Input();
- //Solve();
- return ;
- }
ural 1221. Malevich Strikes Back!的更多相关文章
- ural1221. Malevich Strikes Back!
http://acm.timus.ru/problem.aspx?space=1&num=1221 算是枚举的 题目意思是必须划出这样的 11011 10001 00000 10001 110 ...
- ural 1221
本来就是个很水的题 就是枚举起点长度然后直接判断就行了 但是比赛的时候写了个大bug 还找不出来 自己太水了 #include <cstdio> #include <c ...
- BZOJ 1221: [HNOI2001] 软件开发
1221: [HNOI2001] 软件开发 Time Limit: 10 Sec Memory Limit: 162 MBSubmit: 1428 Solved: 791[Submit][Stat ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
随机推荐
- 淘宝(阿里百川)手机客户端开发日记第八篇 Handler的使用方法
首先,我们先看下API文档的说明: A Handler allows you to send and process Message and Runnable objects associated w ...
- Linux下网络故障诊断
导读 由于实现网络服务器的层次结构比较多,因此当网络出现故障时,解决起来比较复杂.下面由我来为大家详细介绍Linux系统中可能出现的一些网络问题,如网卡硬件问题.网络配置问题.驱动程序问题,以及网络层 ...
- bmob
移动后台: bmob http://baike.baidu.com/link?url=GHdwJY3cGygcfQDdzosckQnhVy1pvIGZA2Ws0K26lSSFGu7QRX4R1wlo6 ...
- FZU 1649 Prime number or not米勒拉宾大素数判定方法。
C - Prime number or not Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%I64d & % ...
- linux /etc/rc.d/目录的详解
rc.d的内容如下: init.d/ :各种服务器和程序的二进制文件存放目录. rcx.d/: 各个启动级别的执行程序连接目录.里头的东西都是指向init.d/的一些软连接.具体的后边叙述. 还有三个 ...
- Jquery获取数据并生成下拉菜单
<script type="text/javascript"> $(document).ready(function() { GetByJquery(); $(&quo ...
- MVC NonAction属性
3.1. NonAction属性 若将NonAction属性应用在Controller中的Action方法上,即使该Action方法是公共方法,也会告知ActionInvoker不要选取这个Actio ...
- 58. 分析、测试与总结:罗马数字和阿拉伯数字的转换[roman to integer and integer to roman in c++]
[本文链接] http://www.cnblogs.com/hellogiser/p/roman-to-integer-and-integer-to-roman.html [题目] 给出一个罗马数字, ...
- Java for LeetCode 072 Edit Distance【HARD】
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2 ...
- QQ图片名字
ﻩ并亲了你一下ﻩ大兔子҉҉大兔子҉҉҉҉҉҉҉҉