結果

問題 No.640 76本のトロンボーン
ユーザー kuuso1kuuso1
提出日時 2018-01-26 23:16:15
言語 C#(csc)
(csc 3.9.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 3,647 bytes
コンパイル時間 5,063 ms
コンパイル使用メモリ 111,416 KB
実行使用メモリ 22,832 KB
最終ジャッジ日時 2023-09-03 23:30:53
合計ジャッジ時間 6,433 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
22,656 KB
testcase_01 AC 58 ms
20,628 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 57 ms
20,692 KB
testcase_05 AC 56 ms
20,736 KB
testcase_06 AC 59 ms
20,752 KB
testcase_07 AC 58 ms
20,780 KB
testcase_08 AC 59 ms
20,816 KB
testcase_09 AC 59 ms
20,892 KB
testcase_10 AC 57 ms
20,700 KB
testcase_11 AC 59 ms
20,788 KB
testcase_12 AC 59 ms
20,704 KB
testcase_13 AC 57 ms
20,792 KB
testcase_14 AC 58 ms
22,656 KB
testcase_15 AC 57 ms
22,832 KB
testcase_16 AC 58 ms
22,708 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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));}
}
0