結果

問題 No.179 塗り分け
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2019-03-20 17:05:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 83 ms / 3,000 ms
コード長 2,469 bytes
コンパイル時間 2,215 ms
コンパイル使用メモリ 71,388 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-30 21:07:42
合計ジャッジ時間 3,286 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 15 ms
4,376 KB
testcase_06 AC 6 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 14 ms
4,380 KB
testcase_11 AC 12 ms
4,380 KB
testcase_12 AC 42 ms
4,376 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 25 ms
4,376 KB
testcase_19 AC 24 ms
4,376 KB
testcase_20 AC 46 ms
4,376 KB
testcase_21 AC 55 ms
4,376 KB
testcase_22 AC 56 ms
4,376 KB
testcase_23 AC 20 ms
4,376 KB
testcase_24 AC 52 ms
4,380 KB
testcase_25 AC 27 ms
4,380 KB
testcase_26 AC 31 ms
4,380 KB
testcase_27 AC 78 ms
4,376 KB
testcase_28 AC 41 ms
4,380 KB
testcase_29 AC 82 ms
4,376 KB
testcase_30 AC 22 ms
4,380 KB
testcase_31 AC 83 ms
4,376 KB
testcase_32 AC 27 ms
4,376 KB
testcase_33 AC 79 ms
4,376 KB
testcase_34 AC 32 ms
4,376 KB
testcase_35 AC 81 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 8 ms
4,376 KB
testcase_44 AC 18 ms
4,380 KB
testcase_45 AC 4 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int ncrset()’:
main.cpp:33:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^

ソースコード

diff #

#include<cstdio>
#include<queue>
#include<utility>
#include<cstring>
#include<stack>
#include<algorithm>
#include<cmath>
#include<iostream>
#define MAX_N 100001
#define INF 2147483647
#define REP(i,n) for(int i=0;i<(int)(n);i++)
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
using namespace std;

struct edge{
  int from,to;
};
typedef vector<vector<edge> > AdjList;
typedef long long ll;
typedef pair<int , int> P;
long long int MOD = 1000000007;
long long int ruiseki[200001];
int ncrset(){
  ruiseki[0] = 1;
  for(int i=1;i<200001;i++){
    ruiseki[i] = (ruiseki[i-1] * i) % MOD;
  }
}

long long int powld(long long int x,long long int n){
  long long int ans = 1;
  while(n > 0){
    if((n&1) == 1){
      ans = (ans*x)  % MOD;
    }
    x = (x*x) % MOD;
    n >>= 1;
  }
  return ans % MOD;
}

ll ncrgyaku(ll n,ll r){
  long long int gyakuk,gyakur;
  long long int res = 1,x,y,z;
  y = powld(ruiseki[r],MOD-2);
  z = powld(ruiseki[n-r],MOD-2);
  return (((ruiseki[n]*y) % MOD)*z) % MOD;

}

vector< vector<ll> > graph[4];
ll N,M,u,v;
string S;
ll memo[100001];

ll solve(int n,int LEVEL){
  if(memo[n] != -1)
    return memo[n];
  if(LEVEL == 3){
    return memo[n] = 1;
  }
  LEVEL++;
  ll res=0;
  for(int i=0;i<graph[LEVEL][n].size();i++){
    res = (res+solve(graph[LEVEL][n][i],LEVEL))%MOD;
  }
  return memo[n] = res;
}

int main()
{
  ll H,W,f=0;
  char masu[100][100],tmp[100][100];
  cin >> H >> W;
  REP(i,H)
    cin >> masu[i];
  for(int i=0;i<H;i++)
    for(int j=0;j<W;j++){
      if(masu[i][j] == '#'){
        f= 1;
      }
    }
  if(!f){
    cout << "NO" << endl;
    return 0;
  }
  for(int i=-52;i<=52;i++){
    for(int j=-52;j<=52;j++){
      if(i == j && i == 0)
        continue;
      for(int k=0;k<H;k++)
        for(int l=0;l<W;l++)
          tmp[k][l] = masu[k][l];
      f = 0;
      for(int k=0;k<H;k++)
        for(int l=0;l<W;l++)
          if(i+k < H && j+l < W && i+k >= 0 && j+l >= 0){
            if(tmp[k][l] == tmp[i+k][l+j]){
              tmp[k][l] = '.';
              tmp[i+k][l+j] = '.';
              
            }
          }
      for(int k=0;k<H;k++)
        for(int l=0;l<W;l++){
          if(tmp[k][l] == '#'){
            k = H;
            l = W;
            f = 9;
            break;
          }
        }
      if(!f){
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
0