結果

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