結果

問題 No.3710 Universal Tiles
コンテスト
ユーザー yuunegi
提出日時 2026-09-11 21:42:26
言語 C++23
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 85 ms / 2,000 ms
+ 88µs
コード長 1,113 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 2,137 ms
コンパイル使用メモリ 339,656 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-11 21:42:41
合計ジャッジ時間 4,337 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m;
    cin>>n>>m;
    vector<vector<string>>s(n,vector<string>(m));
    int sz=1;
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            cin>>s[i][j];
        }
        sz*=4;
    }
    int ans=1e9;
    for(int i=0;i<sz;i++){
        vector<int>tmp(n);
        int t2=i;
        for(int j=0;j<n;j++){
            tmp[j]=t2%4;
            t2/=4;
        }
        int sum=0;
        for(int j=0;j<m;j++){
            for(int k=0;k<m;k++){
                int flag=0;
                for(int l=0;l<n;l++){
                    if(tmp[l]==1){
                        if(s[l][k][j]=='#')flag=1;
                    }else if(tmp[l]==2){
                        if(s[l][m-k-1][m-j-1]=='#')flag=1;
                    }else if(tmp[l]==3){
                        if(s[l][m-j-1][k]=='#')flag=1;
                    }else{
                        if(s[l][j][m-k-1]=='#')flag=1;
                    }
                }
                sum+=flag;
            }
        }
        ans=min(sum,ans);
    }
    cout<<ans<<endl;
    return 0;
}
0