結果

問題 No.452 横着者のビンゴゲーム
ユーザー imulanimulan
提出日時 2016-12-03 01:10:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,325 bytes
コンパイル時間 1,802 ms
コンパイル使用メモリ 177,812 KB
実行使用メモリ 8,168 KB
最終ジャッジ日時 2023-08-18 11:51:45
合計ジャッジ時間 32,680 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 9 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 11 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 5 ms
4,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 4 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2,918 ms
4,376 KB
testcase_15 AC 2,860 ms
4,376 KB
testcase_16 AC 1,577 ms
4,380 KB
testcase_17 AC 106 ms
8,168 KB
testcase_18 AC 312 ms
4,376 KB
testcase_19 AC 211 ms
4,384 KB
testcase_20 AC 143 ms
7,880 KB
testcase_21 AC 743 ms
4,380 KB
testcase_22 AC 104 ms
7,880 KB
testcase_23 AC 1,358 ms
4,376 KB
testcase_24 AC 75 ms
7,880 KB
testcase_25 AC 45 ms
6,048 KB
testcase_26 AC 834 ms
4,380 KB
testcase_27 AC 585 ms
5,840 KB
testcase_28 AC 352 ms
4,376 KB
testcase_29 AC 220 ms
4,380 KB
testcase_30 AC 968 ms
4,376 KB
testcase_31 AC 153 ms
4,376 KB
testcase_32 AC 97 ms
5,652 KB
testcase_33 AC 423 ms
4,376 KB
testcase_34 AC 363 ms
4,384 KB
testcase_35 AC 276 ms
5,908 KB
testcase_36 AC 58 ms
7,704 KB
testcase_37 AC 55 ms
7,924 KB
testcase_38 TLE -
testcase_39 AC 2,181 ms
4,380 KB
testcase_40 AC 2,185 ms
4,376 KB
testcase_41 AC 2,191 ms
4,376 KB
testcase_42 AC 2,180 ms
4,376 KB
testcase_43 AC 2,178 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int main()
{
    int n,m;
    int c[200][100][100];

    scanf(" %d %d", &n, &m);
    rep(i,m)rep(j,n)rep(k,n) scanf(" %d", &c[i][j][k]);

    vector<vector<int>> bingo[200];
    rep(i,m)
    {
        vector<int> tmp(n);

        // 縦
        rep(j,n)
        {
            rep(k,n) tmp[k]=c[i][k][j];
            bingo[i].pb(tmp);
        }
        // 横
        rep(j,n)
        {
            rep(k,n) tmp[k]=c[i][j][k];
            bingo[i].pb(tmp);
        }
        //斜め
        rep(j,n) tmp[j]=c[i][j][j];
        bingo[i].pb(tmp);
        rep(j,n) tmp[j]=c[i][n-1-j][j];
        bingo[i].pb(tmp);
    }

    int ans=123456;
    rep(i,m)rep(j,i)
    {
        rep(a,bingo[i].size())rep(b,bingo[j].size())
        {
            set<int> nums;
            rep(k,bingo[i][a].size()) nums.insert(bingo[i][a][k]);
            rep(k,bingo[j][b].size()) nums.insert(bingo[j][b][k]);

            int S=nums.size();
            ans=min(ans,S-1);
        }
    }

    if(ans<1) ans=1;
    printf("%d\n", ans);
    return 0;
}
0