結果

問題 No.452 横着者のビンゴゲーム
ユーザー ebicochinealebicochineal
提出日時 2016-12-03 18:10:40
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,424 bytes
コンパイル時間 1,681 ms
コンパイル使用メモリ 171,836 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-08-18 12:51:54
合計ジャッジ時間 6,574 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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];
        }
    }
    unordered_set<int> s{};
    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) {
                    s.clear();
                    for (int k = 0; k < N; ++k) {
                        s.emplace(L[m][a][k]);
                        s.emplace(L[i][j][k]);
                    }
                    cnt = max(cnt, N*2-(int)s.size());
                }
            }
        }
    }
    
    cout << N+N-cnt-1 << endl;
    return 0;
}
0