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>
#include <cstring>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <queue>
#include <deque>
#include <queue>
#include <list>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <functional>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
#include <ctime> #define INF 0x3f3f3f3f
#define REP(i, n) for(int i=0;i<int(n);++i)
#define FOR(i, a, b) for(int i=int(a);i<int(b);++i)
#define DWN(i, b, a) for(int i=int(b-1);i>=int(a);--i)
#define REP_1(i, n) for(int i=1;i<=int(n);++i)
#define mid int m=(l+r)/2
using namespace std;
int a[][], rows[], cols[];
int main ( int argc, char *argv[] )
{
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
int n; cin>>n;
char ch;
getchar();
REP(i, n) {
REP(j, n) {
scanf("%c", &ch);
if (ch == '.') a[i][j] = ;
else a[i][j] = ;
}
getchar();
}
bool flaga = true, flagb = true;
vector<pair<int, int> > v;
// REP(i, n) { /*here is error */
// flag = false; /* can not judge like this */
// REP(j, n) { /* short of some instance */
// if (a[i][j] == 1) {
// v.push_back(make_pair(i+1,j+1)); flag = true;
// break;
// }
// }
// if (!flag) break;
// }
REP(i, n) {
REP(j, n) {
rows[i] += a[i][j];
cols[j] += a[i][j];
}
}
REP(i, n) {
if (!rows[i]) flaga = false;
if (!cols[i]) flagb = false;
}
if (!flaga && !flagb) cout<<"-1"<<endl;
else {
if (!flagb)
REP(i, n) {
REP(j, n) {
if (a[i][j] == ) {v.push_back(make_pair(i+, j+)); break;}
}
}
else
REP(j, n) {
REP(i, n) {
if (a[i][j] == ) {v.push_back(make_pair(i+, j+)); break;}
}
}
vector<pair<int, int> >::iterator it;
for (it = v.begin(); it != v.end(); ++it) {
cout << (*it).first<<' '<<(*it).second<<endl;
}
}
return EXIT_SUCCESS;
} /* ---------- end of function main ---------- */

I got a WA in the match. sad.....

codeforces 192 c的更多相关文章

  1. [Codeforces #192] Tutorial

    Link: Codeforces #192 传送门 前两天由于食物中毒现在还要每天挂一天的水 只好晚上回来随便找套题做做找找感觉了o(╯□╰)o A: 看到直接大力模拟了 但有一个更简便的方法,复杂度 ...

  2. codeforces 192 D

    link: http://codeforces.com/contest/330/problem/D The discription looks so long, but the problem is ...

  3. CodeForces Round 192 Div2

    This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contemp ...

  4. Codeforces Round #192 (Div. 1) C. Graph Reconstruction 随机化

    C. Graph Reconstruction Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/3 ...

  5. Codeforces Round #192 (Div. 1) B. Biridian Forest 暴力bfs

    B. Biridian Forest Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/pr ...

  6. Codeforces Round #192 (Div. 1) A. Purification 贪心

    A. Purification Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/329/probl ...

  7. [Codeforces Round #192 (Div. 2)] D. Biridian Forest

    D. Biridian Forest time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  8. Codeforces Round #192 (Div. 2) (330B) B.Road Construction

    题意: 要在N个城市之间修建道路,使得任意两个城市都可以到达,而且不超过两条路,还有,有些城市之间是不能修建道路的. 思路: 要将N个城市全部相连,刚开始以为是最小生成树的问题,其实就是一道简单的题目 ...

  9. Codeforces Round #192 (Div. 2) (330A) A. Cakeminator

    题意: 如果某一行没有草莓,就可以吃掉这一行,某一列没有也可以吃点这一列,求最多会被吃掉多少块蛋糕. //cf 192 div2 #include <stdio.h> #include & ...

随机推荐

  1. Java 类的高级特征2

    1. static 关键字 static,静态的,可以用来属性.方法.*代码块(或初始化块).*内部类 (1) static修饰属性(类变量):  1.由类创建的所有的对象,都共用这一个属性 2.当其 ...

  2. HDU5478 原根求解

    看别人做的很简单我也不知道是怎么写出来的 自己拿到这道题的想法就是模为素数,那必然有原根r ,将a看做r^a , b看做r^b那么只要求出幂a,b就能得到所求值a,b 自己慢慢化简就会发现可以抵消n然 ...

  3. 戴文的Linux内核专题:10配置内核(6)

    转自Linux中国 欢迎来到下一篇关于内核配置文章!还有大量的选项需要配置.这篇文章将主要讨论PCI和ACPI. 这里我们可以启用由ACPI控制的扩展坞和可移动驱动器槽的支持(Dock).记住,ACP ...

  4. 【转发】RedHat Enterprise Linux 6.4 使用 Centos 6 的yum源问题

    作为一名新手,学习Linux已经一个月了,其间遇到了不少问题,而今天笔者遇到的问题是 #yum install pam-devel #This system is not registered to ...

  5. hadoop shell 操作命令

    shell操作命令: hdfs的路径,在core-site.xml中定义 <property> <name>fs.default.name</name> <v ...

  6. unix shell-01 file

    1 一个文件有三种访问方式: 1.读,可以显示该文件的内容 2.写,删除或者编辑这个文件 3.执行,如果该文件时一个shell脚本或程序 按照文件所针对的用户,用户可以分为三种: 1.文件属主,即该文 ...

  7. Windows Azure上搭建SSTP VPN

    一.服务器设置 首先,从0开始,你需要创建一个新的VM.我选择Windows Server 2012 R2,所有步骤和创建普通VM都一样,但最后在防火墙设置里一定要打开TCP 443端口: 创建完成后 ...

  8. C# Sandboxer

    public static string IsolateCallV1(PageContentHandler pHandler) { string name = Guid.NewGuid().ToStr ...

  9. java基础-004

    ---恢复内容开始--- 14.Java集合类框架的基本接口 集合类接口指定了一组叫做元素的对象.集合类接口的每一种具体的实现类都可以选择以它自己的方式对元素进行保存和排序.有的集合类允许重复的键,有 ...

  10. (转)UIApplication sharedApplication详细解释-IOS

    iPhone应用程序是由主函数main启动,它负责调用UIApplicationMain函数,该函数的形式如下所示: int UIApplicationMain ( int argc, char *a ...