結果
| 問題 |
No.640 76本のトロンボーン
|
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2018-01-26 23:03:12 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,719 bytes |
| コンパイル時間 | 5,252 ms |
| コンパイル使用メモリ | 109,440 KB |
| 実行使用メモリ | 18,048 KB |
| 最終ジャッジ日時 | 2024-12-28 01:42:14 |
| 合計ジャッジ時間 | 3,647 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 4 |
コンパイルメッセージ
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;
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));
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 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));}
}
kuuso1