https://www.acmicpc.net/problem/10951

- 출력은 맨 왼쪽(세로인경우 맨위) 돌임에 주의한다.
- 찾는 방향은 오른쪽, 아래, 오른쪽 위 대각선, 오른쪽 아래 대각선
- 6목인 경우를 주의한다.
- 5개를 찾고 나서 반대 방향(왼쪽, 위, 왼쪽아래 대각선, 왼쪽 위 대각선) 돌을 더 검사하여 6목인지 체크 !
#include <iostream>
#include <vector>
#define BLACK 1
#define WHITE 2
#define DEBUG(X) //cout << X;
using namespace std;
const int N = 19;
int arr[N+4][N+4];
int dy[] = {0, 1, 1, -1}; // 오른쪽, 아래, 오아, 오위 대각선만 검사
int dx[] = {1, 0, 1, 1};
void Input()
{
    for(int i=0; i<N; i++)
    {   
        for(int j=0; j<N; j++)
        {
            cin >> arr[i][j];
        }
    }
    return;
}
bool IsOmok(int color, int y, int x, int dir, int cnt)
{
    for(; color == arr[y][x]; cnt++)
    {
        y += dy[dir]; 
        x += dx[dir];
    }
    
    return (cnt == 5);
}
void Solve()
{   
    for(int i=0; i<N; i++)
    {   
        for(int j=0; j<N; j++)
        {
            if (arr[i][j] != 0)
            {
                for(int dir=0; dir<4; dir++)
                {
                    if (IsOmok(arr[i][j], i, j, dir, 0))
                    {
                        int by = i - dy[dir];
                        int bx = j - dx[dir];
                        // 범위 안이면 검사 
                        if (by >= 0 || by < N || bx >= 0 || bx < N)
                        {
                            // 6목 X
                            if (arr[by][bx] != arr[i][j]) 
                            {
                                cout << arr[i][j] << '\n' << i+1 << ' ' << j+1 << '\n';
                                return;
                            }
                        }
                        else 
                        {
                            cout << arr[i][j] << '\n' << i+1 << ' ' << j+1 << '\n';
                            return;
                        }
                    }
                }
            }
        }
    }
    cout << '0';
    
    return;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    Input();
    Solve();
    return 0;
}6목인 경우를 제대로 체크하지 못해서 틀렸다.