結果

問題 No.239 にゃんぱすー
ユーザー spaciaspacia
提出日時 2016-01-02 08:00:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 103 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 77,716 KB
実行使用メモリ 55,488 KB
最終ジャッジ日時 2023-10-19 13:29:40
合計ジャッジ時間 5,989 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
53,540 KB
testcase_01 AC 55 ms
52,812 KB
testcase_02 AC 52 ms
52,812 KB
testcase_03 AC 52 ms
52,804 KB
testcase_04 AC 54 ms
52,812 KB
testcase_05 AC 51 ms
52,812 KB
testcase_06 AC 52 ms
53,604 KB
testcase_07 AC 52 ms
52,828 KB
testcase_08 AC 51 ms
52,796 KB
testcase_09 AC 52 ms
52,816 KB
testcase_10 AC 52 ms
53,532 KB
testcase_11 AC 53 ms
53,548 KB
testcase_12 AC 55 ms
53,540 KB
testcase_13 AC 55 ms
53,544 KB
testcase_14 AC 58 ms
53,552 KB
testcase_15 AC 59 ms
53,628 KB
testcase_16 AC 65 ms
54,112 KB
testcase_17 AC 76 ms
53,628 KB
testcase_18 AC 78 ms
54,116 KB
testcase_19 AC 73 ms
54,120 KB
testcase_20 AC 76 ms
54,768 KB
testcase_21 AC 82 ms
54,132 KB
testcase_22 AC 91 ms
55,048 KB
testcase_23 AC 86 ms
54,392 KB
testcase_24 AC 98 ms
55,324 KB
testcase_25 AC 96 ms
55,068 KB
testcase_26 AC 93 ms
55,488 KB
testcase_27 AC 52 ms
53,536 KB
testcase_28 AC 53 ms
53,544 KB
testcase_29 AC 55 ms
53,548 KB
testcase_30 AC 56 ms
52,532 KB
testcase_31 AC 68 ms
53,628 KB
testcase_32 AC 70 ms
54,184 KB
testcase_33 AC 89 ms
54,904 KB
testcase_34 AC 88 ms
55,136 KB
testcase_35 AC 103 ms
54,924 KB
testcase_36 AC 98 ms
55,304 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main239 {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static int solve (String[][] memo) {
		int ret = -1;
		for (int i = 0; i < memo.length; i++) {
			for (int j = 0; j < memo.length; j++) {
				String s = memo[j][i];
				if (!s.equals("nyanpass") && !s.equals("-")) break;
				if (j == memo.length - 1) {
					if (ret != -1) return -1;
					ret = i + 1;
				}
			}
		}
		return ret;
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		String[][] memo = new String[n][n];
		
		for (int i = 0; i < n; i++) {
			String[] line = br.readLine().split(" ");
			for (int j = 0; j < n; j++) {
				memo[i][j] = line[j];
			}
		}
		
		out(solve(memo));
		
	}
}
0