Submission

Status:

-P-----------P----PP

Subtask/Task Score:

20/100

Score: 20

User: ChanakanStudy

Problemset: Othello

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-15 14:23:55

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <numeric>
#include <iomanip>
using namespace std;
using ll = long long;
// void checkohello(char ohello[i][j] , )

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    char ohello[8][8];
    for(int i = 0;i<8;i++) {
        for(int j = 0;j<8;j++) {
            cin >> ohello[i][j];
        }
    }
    map<int , char> mapping = {{0 ,'B'} , {1,'W'}};
    int turn = 0;
    while(true) {
        int x,y;
        cin >> x >> y;
        if(x == -1 && y == -1) {
            break;
        }
        if(turn%2 == 0) {
            ohello[x][y] = 'B';
        }
        else {
            ohello[x][y] = 'W';
        }
        bool check = false;
        turn++;
    }
    int countB = 0 ,countW = 0;
    for(int i = 0;i<8;i++) {
        for(int j = 0;j<8;j++) {
            if(ohello[i][j] == 'B') {
                countB++;
            }
            else if (ohello[i][j] == 'W') {
                countW++;
            }
            cout << ohello[i][j];
        }
        cout << '\n';
    }

    if(countB > countW) {
        cout << "black wins";
    }
    else if (countW > countB) {
        cout << "white wins";
    }
    else {
        cout << "draw";
    }

    return 0;
}