結果
| 問題 |
No.179 塗り分け
|
| ユーザー |
kuuso1
|
| 提出日時 | 2015-04-05 23:48:55 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,561 bytes |
| コンパイル時間 | 2,414 ms |
| コンパイル使用メモリ | 107,136 KB |
| 実行使用メモリ | 21,376 KB |
| 最終ジャッジ日時 | 2024-10-02 13:18:12 |
| 合計ジャッジ時間 | 3,546 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 28 WA * 12 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
found=false;
int i0=-1;int j0=-1;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(S[i][j]=='.')continue;
if(i0==-1){
i0=i;j0=j;
continue;
}
if(!found){
check(i-i0,j-j0);
}
}
}
Console.WriteLine(found?"YES":"NO");
}
void check(int offi,int offj){
if(found)return;
bool[,] brd=new bool[N,M];
bool chk=true;
for(int i=0;i<N;i++){
for(int j=0;j<M;j++){
if(S[i][j]=='.')continue;
if(brd[i,j]==true)continue;
if(i+offi<N && i+offi>=0 && j+offj<M && j+offj>=0){
brd[i,j]=true;
brd[i+offi,j+offj]=true;
}else{
return;
}
}
}
if(chk)found=true;
}
bool found;
int N,M;
String[] S;
public Sol(){
var d=ria();
N=d[0];M=d[1];
S=new String[N];
for(int i=0;i<N;i++)S[i]=rs();
}
static String rs(){return Console.ReadLine();}
static int ri(){return int.Parse(Console.ReadLine());}
static long rl(){return long.Parse(Console.ReadLine());}
static double rd(){return double.Parse(Console.ReadLine());}
static String[] rsa(){return Console.ReadLine().Split(' ');}
static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
kuuso1