Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define f first
- #define s second
- #define ll long long
- #define vi vector<int>
- #define vvi vector<vi>
- #define FORn(i, n) for(ll i = 1; i <= (n); i++)
- /* ----------------- ~~~~~~~ ----------------- */
- int res = 0;
- string Res;
- vector<string> a(10);
- vvi d(10, vi(10));
- void prc(int r, int c, int y, int x, int n = 0){
- if(a[r + y][c + x] == 'W')
- prc(r + y, c + x, y, x, n + 1);
- else if(a[r + y][c + x] == '.'){
- d[r + y][c + x] += n;
- if(d[r + y][c + x] > res)
- res = d[r + y][c + x],
- Res = string(1, c + x - 1 + 'a') + string(1, r + y + '0');
- }
- // getch();
- }
- /* ----------------- ~~~~~~~ ----------------- */
- int main(){
- //freopen("INPUT.inp", "r", stdin);
- //freopen("OUTPUT.out", "w", stdout);
- //ios_base::sync_with_stdio(0); cin.tie(0);
- /* ----------------- main func ----------------- */
- a[0] = a[9] = " ";
- FORn(i, 8){
- cin >> a[i];
- a[i] = " " + a[i] + " ";
- }
- FORn(i, 8)
- FORn(j, 8)
- if(a[i][j] == 'B'){
- prc(i, j, -1, -1);
- prc(i, j, -1, 0);
- prc(i, j, -1, 1);
- prc(i, j, 0, -1);
- prc(i, j, 0, 1);
- prc(i, j, 1, -1);
- prc(i, j, 1, 0);
- prc(i, j, 1, 1);
- }
- cout << Res << ' ' << res;
- /* ----------------- ~~~~~~~~~ ----------------- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement