結果

問題 No.452 横着者のビンゴゲーム
ユーザー face4face4
提出日時 2019-10-17 17:05:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,094 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 75,712 KB
実行使用メモリ 7,348 KB
最終ジャッジ日時 2023-09-07 01:03:42
合計ジャッジ時間 29,283 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 8 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 10 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 4 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1,958 ms
7,348 KB
testcase_15 AC 1,926 ms
7,232 KB
testcase_16 AC 1,133 ms
5,448 KB
testcase_17 AC 97 ms
4,376 KB
testcase_18 AC 300 ms
4,376 KB
testcase_19 AC 185 ms
4,380 KB
testcase_20 AC 120 ms
4,384 KB
testcase_21 AC 733 ms
4,460 KB
testcase_22 AC 88 ms
4,376 KB
testcase_23 AC 1,347 ms
5,180 KB
testcase_24 AC 72 ms
4,376 KB
testcase_25 AC 38 ms
4,376 KB
testcase_26 AC 814 ms
4,376 KB
testcase_27 AC 535 ms
4,376 KB
testcase_28 AC 341 ms
4,380 KB
testcase_29 AC 199 ms
4,380 KB
testcase_30 AC 958 ms
4,820 KB
testcase_31 AC 140 ms
4,376 KB
testcase_32 AC 83 ms
4,380 KB
testcase_33 AC 380 ms
4,376 KB
testcase_34 AC 340 ms
4,376 KB
testcase_35 AC 238 ms
4,380 KB
testcase_36 AC 48 ms
4,380 KB
testcase_37 AC 53 ms
4,380 KB
testcase_38 TLE -
testcase_39 AC 2,161 ms
5,396 KB
testcase_40 AC 2,151 ms
5,364 KB
testcase_41 AC 2,151 ms
5,444 KB
testcase_42 AC 2,158 ms
5,396 KB
testcase_43 AC 2,154 ms
5,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 恐らく (M^2*(2*N+2)^2)*log(2*N) ~~ N^2 M^2 log(N)
#include<iostream>
#include<set>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int c[m][n][n];
    for(int i = 0; i < m; i++)
        for(int j = 0; j < n*n; j++)
            cin >> c[i][j/n][j%n];
    set<int> s[m][2*n+2];
    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            s[i][2*n].insert(c[i][j][j]);
            s[i][2*n+1].insert(c[i][n-1-j][j]);
        }
        for(int j = 0; j < n; j++){
            for(int k = 0; k < n; k++){
                s[i][j].insert(c[i][j][k]);
                s[i][n+j].insert(c[i][k][j]);
            }
        }
    }
    int ans = 2*n;
    for(int i = 0; i < m; i++){
        for(int j = i+1; j < m; j++){
            for(int k = 0; k < 2*n+2; k++){
                for(int l = 0; l < 2*n+2; l++){
                    set<int> x = s[i][k];
                    x.insert(s[j][l].begin(),s[j][l].end());
                    ans = min(ans, (int)x.size()-1);
                }
            }
        }
    }
    cout << ans << endl;
    return 0;
}
0