結果

問題 No.452 横着者のビンゴゲーム
ユーザー ebicochinealebicochineal
提出日時 2016-12-03 18:04:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,406 bytes
コンパイル時間 1,480 ms
コンパイル使用メモリ 166,916 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-18 12:51:46
合計ジャッジ時間 22,896 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,384 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 TLE -
testcase_15 TLE -
testcase_16 AC 1,112 ms
4,380 KB
testcase_17 AC 8 ms
4,376 KB
testcase_18 AC 83 ms
4,380 KB
testcase_19 AC 20 ms
4,380 KB
testcase_20 AC 12 ms
4,380 KB
testcase_21 AC 330 ms
4,380 KB
testcase_22 AC 8 ms
4,376 KB
testcase_23 AC 818 ms
4,376 KB
testcase_24 AC 6 ms
4,376 KB
testcase_25 AC 5 ms
4,376 KB
testcase_26 AC 275 ms
4,376 KB
testcase_27 AC 88 ms
4,380 KB
testcase_28 AC 97 ms
4,380 KB
testcase_29 AC 26 ms
4,380 KB
testcase_30 AC 514 ms
4,380 KB
testcase_31 AC 24 ms
4,376 KB
testcase_32 AC 9 ms
4,380 KB
testcase_33 AC 61 ms
4,376 KB
testcase_34 AC 64 ms
4,376 KB
testcase_35 AC 24 ms
4,376 KB
testcase_36 AC 5 ms
4,380 KB
testcase_37 AC 5 ms
4,380 KB
testcase_38 AC 2,853 ms
4,376 KB
testcase_39 AC 1,111 ms
4,380 KB
testcase_40 AC 1,113 ms
4,380 KB
testcase_41 AC 1,110 ms
4,376 KB
testcase_42 AC 1,109 ms
4,380 KB
testcase_43 AC 1,111 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
    int N, M;
    cin >> N >> M;
    int B[M][N][N];
    int L[M][N*2+2][N];
    int cnt = 0;
    for (int m = 0; m < M; ++m) {
        for (int y = 0; y < N; ++y) {
            for (int x = 0; x < N; ++x) {
                cin >> B[m][x][y];
            }
        }
    }
    for (int m = 0; m < M; ++m) {
        int c = 0;
        for (int x = 0; x < N; ++x, ++c) {
            for (int i = 0; i < N; ++i) {
                L[m][c][i] = B[m][x][i];
            }
        }
        for (int y = 0; y < N; ++y, ++c) {
            for (int i = 0; i < N; ++i) {
                L[m][c][i] = B[m][i][y];
            }
        }
        for (int i = 0; i < N; ++i) {
            L[m][c][i] = B[m][i][i];
            L[m][c+1][i] = B[m][i][N-i-1];
        }
    }
    
    for (int m = 0; m < M; ++m) {
        for (int a = 0; a < N*2+2; ++a) {
            for (int i = 0; i < M; ++i) {
                if (i == m) { continue; }
                for (int j = 0, c = 0; j < N*2+2; ++j, c = 0) {
                    for (int k = 0; k < N; ++k) {
                        for (int l = 0; l < N; ++l) {
                            if (L[m][a][k] == L[i][j][l]) { ++c; }
                        }
                    }
                    cnt = max(cnt, c);
                }
            }
        }
    }
    
    cout << N+N-cnt-1 << endl;
    return 0;
}
0