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. Validform自定义提示效果-使用自定义弹出框

    $(function(){ $.Tipmsg.r=null; $("#add").Validform({ tiptype:function(msg){ layer.msg(msg) ...

  2. IBInspectable / IBDesignable

    无论陈词滥调多少次,比起一个需要我们记住并且输入什么的界面来说,如果替换成我们能够看见并可控制的界面的话将会是巨大的进步. Xcode 6 提供了这样一个替代,在旧技术上建立新的互动.在设计项目的时候 ...

  3. 迭代器(Iterator)模式

    转自:http://blog.csdn.net/lilu_leo/article/details/7609496 概述      迭代器(Iterator)模式,又叫做游标(Cursor)模式.GOF ...

  4. MongoDB的C#驱动程序教程(译) 转

    1.概述 本教程是10gen支持C#驱动程序MongoDB的介绍.假定您熟悉使用MongoDB,因此主要集中在如何使用C#访问MongoDB的. 它分为两个部分:C# 驱动程序 ,BSON图书馆.C# ...

  5. 【LeetCode OJ】Word Ladder I

    Problem Link: http://oj.leetcode.com/problems/word-ladder/ Two typical techniques are inspected in t ...

  6. 4 Values whose Sum is 0_upper_bound&&ower_bound

    Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer val ...

  7. CodeForces 414D (贪心)

    problem Mashmokh and Water Tanks 题目大意 给你一棵树,k升水,p块钱,进行一次游戏. 在游戏进行前,可以在任意个节点上放置1升水(总数不超过k) 游戏进行若干轮,每轮 ...

  8. BSP、PSP到底指什么?

    /************************************************************************* * BSP.PSP到底指什么? * 说明: * B ...

  9. 特性节点Attribute

    深入理解DOM节点类型第六篇——特性节点Attribute document.getElementById('b_results').attributes[0].textContent documen ...

  10. Tomcat集群---Cluster节点配置(转)

    <!-- Cluster(集群,族) 节点,如果你要配置tomcat集群,则需要使用此节点. className 表示tomcat集群时,之间相互传递信息使用那个类来实现信息之间的传递. cha ...