結果

問題 No.819 Enjapma game
ユーザー betrue12betrue12
提出日時 2019-04-19 22:41:18
言語 C++14
(gcc 12.2.0 + boost 1.81.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 551 bytes
コンパイル時間 1,325 ms
実行使用メモリ 9,772 KB
最終ジャッジ日時 2023-03-31 19:58:02
合計ジャッジ時間 2,886 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,684 KB
testcase_01 AC 1 ms
9,772 KB
testcase_02 AC 2 ms
7,652 KB
testcase_03 AC 1 ms
7,596 KB
testcase_04 AC 1 ms
7,656 KB
testcase_05 AC 2 ms
7,672 KB
testcase_06 AC 2 ms
7,672 KB
testcase_07 AC 1 ms
7,612 KB
testcase_08 AC 1 ms
9,704 KB
testcase_09 AC 1 ms
7,680 KB
testcase_10 AC 2 ms
7,616 KB
testcase_11 AC 2 ms
9,708 KB
testcase_12 AC 2 ms
7,660 KB
testcase_13 AC 2 ms
7,656 KB
testcase_14 AC 2 ms
7,604 KB
testcase_15 AC 2 ms
7,608 KB
testcase_16 AC 2 ms
9,768 KB
testcase_17 AC 2 ms
9,688 KB
testcase_18 AC 2 ms
7,600 KB
testcase_19 AC 2 ms
7,576 KB
testcase_20 AC 3 ms
7,584 KB
testcase_21 AC 3 ms
9,696 KB
testcase_22 AC 3 ms
7,648 KB
testcase_23 AC 2 ms
7,600 KB
testcase_24 AC 2 ms
7,596 KB
testcase_25 AC 2 ms
9,768 KB
testcase_26 AC 3 ms
9,696 KB
testcase_27 AC 2 ms
7,568 KB
testcase_28 AC 2 ms
7,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int H, W;
    cin >> H >> W;
    int num[2] = {0};
    for(int i=H-1; i>=0; i--){
        string S;
        cin >> S;
        for(int j=0; j<W; j++) if(S[j] == 'o') num[(i+j)%2]++;
    }
    int sum = num[0] + num[1];
    bool win;
    if(sum % 2 == 0){
        int d = abs(num[0] - sum/2);
        win = (d%3 == 0);
    }else{
        int d = min(abs(num[0] - sum/2), abs(num[0] - sum/2 - 1));
        win = (d%3 == 1);
    }

    cout << (win ? "YES" : "NO") << endl;
 
    return 0;
}
0