結果

問題 No.179 塗り分け
ユーザー goodbaton
提出日時 2015-04-08 22:34:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,129 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 71,520 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-02 13:51:50
合計ジャッジ時間 1,928 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 35 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:43:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   43 |     scanf("%d%d",&h,&w);
      |     ~~~~~^~~~~~~~~~~~~~
main.cpp:46:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   46 |         scanf("%s",in[i]);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>

using namespace std;
typedef long long ll;

char in[50][51];
int h,w;

bool check(int x,int y){
    bool kaku[50][50] = {0};
    int c=0;
    
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            
            if(!kaku[i][j] && in[i][j]=='#'){
                if(h>i+y && w>j+x && in[i+y][j+x]=='#'){
                    kaku[i+y][j+x]=true;
                    c++;
                }else{
                    return false;
                }
            }
            
        }
    }
    
    if(c==0) return false;
    
    return true;
}

int main(){
    scanf("%d%d",&h,&w);
    
    for(int i=0;i<h;i++){
        scanf("%s",in[i]);
    }
    
    for(int i=0;i<w;i++){
        for(int j=0;j<h;j++){
            
            if(i+j==0) continue;
            
            if(check(i,j)){
                puts("YES");
                return 0;
            }
                
        }
    }
    
    puts("NO");
    
    return 0;
}
0