結果

問題 No.640 76本のトロンボーン
ユーザー kuuso1
提出日時 2018-01-26 23:16:15
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 3,647 bytes
コンパイル時間 4,481 ms
コンパイル使用メモリ 114,992 KB
実行使用メモリ 25,828 KB
最終ジャッジ日時 2024-06-13 04:03:35
合計ジャッジ時間 5,364 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #
プレゼンテーションモードにする

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class TEST{
static void Main(){
Sol mySol =new Sol();
mySol.Solve();
}
}
class Sol{
public void Solve(){
int max = 0;
max = Math.Max(max, chk1(0,0,0));
max = Math.Max(max, chk1(0,1,0));
max = Math.Max(max, chk1(0,0,1));
max = Math.Max(max, chk1(1,0,1));
max = Math.Max(max, chk1(0,N-1,1));
max = Math.Max(max, chk1(1,N-1,1));
max = Math.Max(max, chk1(N-1,0,0));
max = Math.Max(max, chk1(N-1,1,0));
max = Math.Max(max, chk2(0));
max = Math.Max(max, chk2(1));
max = Math.Max(max, chkrot(0));
max = Math.Max(max, chkrot(1));
Console.WriteLine(max);
}
int chk1(int r, int c, int dir){
int cnt = 0;
switch(dir){
case 0: { // horizontal
bool chk = true;
for(int j=c;j<c+N-1;j++) chk &= M[r][j] == '.';
if(chk) cnt++;
for(int j=0;j<N;j++){
bool chk2 = true;
for(int i=0;i<N;i++){
if(i == r) continue;
chk2 &= M[i][j] == '.';
}
if(chk2) cnt++;
}
} break;
case 1: { // vertical
bool chk = true;
for(int i=r;i<r+N-1;i++) chk &= M[i][c] == '.';
if(chk) cnt++;
for(int i=0;i<N;i++){
bool chk2 = true;
for(int j=0;j<N;j++){
if(j == c) continue;
chk2 &= M[i][j] == '.';
}
if(chk2) cnt++;
}
} break;
}
return cnt;
}
int chk2(int dir){
int cnt = 0;
switch(dir){
case 0: { // horizontal
for(int i=0;i<N;i++){
int cnt0 = 0;
for(int j=0;j<N;j++){
if(M[i][j] == '.') cnt0++;
}
if(cnt0 == N) cnt++;
if(cnt0 == N-1){
if(M[i][0] == ',' || M[i][N-1] == ',') cnt++;
}
}
} break;
case 1: { // vertical
for(int j=0;j<N;j++){
int cnt0 = 0;
for(int i=0;i<N;i++){
if(M[i][j] == '.') cnt0++;
}
if(cnt0 == N) cnt++;
if(cnt0 == N-1){
if(M[0][j] == ',' || M[N-1][j] == ',') cnt++;
}
}
} break;
}
return cnt;
}
int chkrot(int dir){
int cnt = 0;
switch(dir){
case 0: {
bool chk = true;
for(int j=0;j<N-1;j++) chk &= M[0][j] == '.';
if(chk) cnt++;
chk = true;
for(int i=0;i<N-1;i++) chk &= M[i][N-1] == '.';
if(chk) cnt++;
chk = true;
for(int j=1;j<N;j++) chk &= M[N-1][j] == '.';
if(chk) cnt++;
chk = true;
for(int i=1;i<N;i++) chk &= M[i][0] == '.';
if(chk) cnt++;
} break;
case 1: {
bool chk = true;
for(int j=1;j<N;j++) chk &= M[0][j] == '.';
if(chk) cnt++;
chk = true;
for(int i=1;i<N;i++) chk &= M[i][N-1] == '.';
if(chk) cnt++;
chk = true;
for(int j=0;j<N-1;j++) chk &= M[N-1][j] == '.';
if(chk) cnt++;
chk = true;
for(int i=0;i<N-1;i++) chk &= M[i][0] == '.';
if(chk) cnt++;
} break;
}
return cnt;
}
int N;
String[] M;
public Sol(){
N = ri();
M = new String[N];
for(int i=0;i<N;i++) M[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(char sep=' '){return Console.ReadLine().Split(sep);}
static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0