結果
問題 | No.640 76本のトロンボーン |
ユーザー | kuuso1 |
提出日時 | 2018-01-26 23:03:12 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,719 bytes |
コンパイル時間 | 3,180 ms |
コンパイル使用メモリ | 110,244 KB |
実行使用メモリ | 22,804 KB |
最終ジャッジ日時 | 2023-08-27 19:37:24 |
合計ジャッジ時間 | 4,409 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 57 ms
20,652 KB |
testcase_01 | AC | 57 ms
20,752 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 56 ms
22,788 KB |
testcase_05 | AC | 57 ms
22,760 KB |
testcase_06 | WA | - |
testcase_07 | AC | 58 ms
20,772 KB |
testcase_08 | AC | 57 ms
20,664 KB |
testcase_09 | AC | 58 ms
22,788 KB |
testcase_10 | AC | 58 ms
20,660 KB |
testcase_11 | AC | 58 ms
20,704 KB |
testcase_12 | AC | 59 ms
20,660 KB |
testcase_13 | WA | - |
testcase_14 | AC | 57 ms
18,700 KB |
testcase_15 | AC | 57 ms
18,708 KB |
testcase_16 | AC | 58 ms
22,748 KB |
コンパイルメッセージ
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));} }