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. c# 配置文件之configSections配置

    对于小型项目来说,配置信息可以通过appSettings进行配置,而如果配置信息太多,appSettings显得有些乱,而且在开发人员调用时,也不够友好,节点名称很容易写错,这时,我们有几种解决方案 ...

  2. Spring与Hibernate整合,实现Hibernate事务管理

    1.所需的jar包 连接池/数据库驱动包 Hibernate相关jar Spring 核心包(5个) Spring aop 包(4个) spring-orm-3.2.5.RELEASE.jar     ...

  3. python解无忧公主的数学时间097.py

    python解无忧公主的数学时间097.py """ python解无忧公主的数学时间097.py codegay 2016年3月30日 00:17:26 http:// ...

  4. UIControlEvents 中各种event被触发的方式解释(zz)

    转自:http://blog.csdn.net/yanxiaoqing/article/details/7108891 在控件事件中,简单解释下下面几个事件.说明:由于是在“iOS 模拟器”中测试的, ...

  5. jsunit测试

    var script = document.createElement('script'); script.src = 'http://static.pay.baidu.com/resource/ba ...

  6. IOS聊天对话界面

    大家好,百忙之中,抽出点空,写个微博,话说好久没写. 最近项目中有碰到写类似微信聊天界面上的效果,特整理了一下,写了一个小的Demo,希望给没头绪的同学们一个参考! 下载地址:http://files ...

  7. HDOJ-三部曲一(搜索、数学)-1013-Sudoku

    Sudoku Time Limit : 4000/2000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submi ...

  8. Java 集合深入理解(5):AbstractCollection

    点击查看 Java 集合框架深入理解 系列, - ( ゜- ゜)つロ 乾杯~ 今天好累,来学学 AbstractCollection 吧! 什么是 AbstractCollection Abstrac ...

  9. https 三次握手

    1,客户端输入https网址,链接到server443端口: 2,服务器手中有一把钥匙和一个锁头,把锁头传递给客户端.数字证书既是公钥,又是锁头 3,客户端拿到锁头后,生成一个随机数,用锁头把随机数锁 ...

  10. iOS-Block两个界面传值

    先说一下思路: 首先,创建两个视图控制器,在第一个视图控制器中创建一个Label和一个Button,其中Label是为了显示第二个视图控制器传过来的字符串, Button是为了push到第二个界面. ...