ural 1221. Malevich Strikes Back!
1221. Malevich Strikes Back!
Memory limit: 64 MB
Input
Output
Sample
input | output |
---|---|
6 |
5 |
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 ...
随机推荐
- xxxx is not translated in zh-rCN, zh-rTW
1.异常提示: "image_content" is not translated in zh-rCN, zh-rTW 2.错误原因: 根据报错提示,是说我没有对string文件做 ...
- nginx reload
iwangzheng.com Usage: nginx [-?hvVt] [-s signal] [-c filename] [-p prefix] [-g directives] Options:- ...
- 2015安徽省赛 A.First Blood
题目描述 盖伦是个小学一年级的学生,在一次数学课的时候,老师给他们出了一个难题: 老师给了一个正整数 n,需要在不大于n的范围内选择三个正整数(可以是相同的),使它们三个的最小公倍数尽可能的大.盖伦很 ...
- nyoj 8
http://acm.nyist.net/JudgeOnline/problem.php?pid=8 #include<stdio.h> #include<iostream> ...
- JSoup——用Java解析html网页内容
当需要从网页上获取信息时,需要解析html页面.筛选指定标签,并获取其值是必不可少的操作,解析html页面这方面的利器,Python有BeautifulSoup,Java一直没有好的工具,之前的Htm ...
- codeigniter load_class
2014年7月7日 14:33:36 函数定义在 system/core/common.php中 使用方法是 load_class('Hooks', 'core'): 在core目录内寻找Hooks类 ...
- cmd的rd命令简单解析
我们知道在Windows下cmd命令行中"rd 文件夹名称"可以删除空目录,"del 文件名"可以删除文件,那么怎么删除一个非空文件夹呢,命令如下: 比如删除文 ...
- CodeForces - 417B (思维题)
Crash Time Limit: 1000MS Memory Limit: 262144KB 64bit IO Format: %I64d & %I64u Submit Status ...
- Thread源码分析
本文为转载,请珍惜别人的劳动成果,注明转载地址:http://www.cnblogs.com/gw811/archive/2012/10/15/2724602.html 1.Runnable接口源码: ...
- Android之shape属性详解
有时候 ,为了满足一些需求,我们要用到 shape 去定义 一些背景,shape 的用法 跟图片一样 ,可以给View设置 Android:background="@drawable/sha ...