1692C - Where's the Bishop - CodeForces Solution


implementation *800

Please click on ads to support us..

Python Code:

for _ in range(int(input())):
	input()
	s = [input() for _ in range(8)]
	for y in range(1, 7):
		for x in range(1, 7):
			if s[y][x] == '#' and s[y-1][x-1] == '#' and s[y-1][x+1] == '#':
				print(y + 1, x + 1)

C++ Code:

#include<bits/stdc++.h>
#include<iostream>
#include<numeric>
using namespace std;

#define FIXED_FLOAT(x) std::fixed <<std::setprecision(1)<<(x) 
#define rep(i, a, n) for(int i = a; i < n; i++)
const int mod = 1e9+7;//998244353;
const double pi = 3.14159265359;
const int INF = INT_MAX;
#define mily cout<<"Loop is working you shit.\n"
#define pb push_back
typedef long long int ll;
typedef long long unsigned llu;
#define cin(x) for(auto &i: x)  cin>>i
#define cout(v) for(auto &i: v) cout<<i<<" ";
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define LSB(n) (n & -n)
#define en "\n"
#define BINARY(number) bitset<64>(number).to_string().substr(64 - (int)(log2(number)) - 1);
#define FARIA                \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);

//Every  problem is a gift without them we  would not grow
//A person who never made a mistake never tried anythink new
//---I know about the spelling thing :B


void solve(){
    string s;
    int row[8]={0}, col[8]={0};

    for(int i=0; i<8; i++){
        cin >> s;
        for(int j=0; j<8; j++){
            if(s[j]=='#'){
                row[i]++;
                col[i]=j+1;
            }
        }
    }
    for(int i=0; i<6; i++){
        if(row[i]==2 && row[i+1]==1 && row[i+2]==2){
            cout << i+2 << " " << col[i+1] << en;
            return;
        }
    }
    //cout(row); cout << en; cout(col);
    cout << en;
}
    
int main(){ 
    // FARIA;
    int t; cin >> t;
    while(t--){
        //cout << t << " ";
        solve();

    }
       
}


Comments

Submit
0 Comments
More Questions

721B - Passwords
1263D - Secret Passwords
1371B - Magical Calendar
1726E - Almost Perfect
1360C - Similar Pairs
900A - Find Extra One
1093D - Beautiful Graph
748A - Santa Claus and a Place in a Class
1511B - GCD Length
676B - Pyramid of Glasses
597A - Divisibility
1632A - ABC
1619D - New Year's Problem
242B - Big Segment
938A - Word Correction
159C - String Manipulation 10
258A - Little Elephant and Bits
1536C - Diluc and Kaeya
1428C - ABBB
1557A - Ezzat and Two Subsequences
255A - Greg's Workout
1059A - Cashier
1389C - Good String
1561A - Simply Strange Sort
1337B - Kana and Dragon Quest game
137C - History
1443C - The Delivery Dilemma
6C - Alice Bob and Chocolate
1077C - Good Array
285B - Find Marble