結果

問題 No.239 にゃんぱすー
ユーザー GrenacheGrenache
提出日時 2015-07-10 22:28:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 840 bytes
コンパイル時間 3,049 ms
コンパイル使用メモリ 72,412 KB
実行使用メモリ 60,096 KB
最終ジャッジ日時 2023-09-22 09:56:11
合計ジャッジ時間 10,586 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
55,836 KB
testcase_01 AC 119 ms
56,364 KB
testcase_02 AC 120 ms
55,860 KB
testcase_03 AC 120 ms
55,956 KB
testcase_04 AC 119 ms
56,072 KB
testcase_05 AC 117 ms
55,728 KB
testcase_06 AC 117 ms
56,000 KB
testcase_07 AC 139 ms
55,564 KB
testcase_08 AC 124 ms
55,804 KB
testcase_09 AC 130 ms
55,756 KB
testcase_10 AC 141 ms
56,596 KB
testcase_11 AC 162 ms
56,104 KB
testcase_12 AC 164 ms
56,732 KB
testcase_13 AC 169 ms
56,352 KB
testcase_14 AC 174 ms
56,320 KB
testcase_15 AC 174 ms
54,636 KB
testcase_16 AC 177 ms
56,532 KB
testcase_17 AC 170 ms
58,480 KB
testcase_18 AC 182 ms
58,364 KB
testcase_19 AC 184 ms
58,440 KB
testcase_20 AC 188 ms
58,596 KB
testcase_21 AC 189 ms
56,752 KB
testcase_22 AC 190 ms
56,992 KB
testcase_23 AC 201 ms
59,048 KB
testcase_24 AC 203 ms
59,336 KB
testcase_25 AC 210 ms
59,656 KB
testcase_26 AC 210 ms
59,900 KB
testcase_27 AC 125 ms
55,812 KB
testcase_28 AC 166 ms
56,256 KB
testcase_29 AC 165 ms
56,428 KB
testcase_30 AC 161 ms
58,368 KB
testcase_31 AC 164 ms
56,160 KB
testcase_32 AC 182 ms
58,624 KB
testcase_33 AC 190 ms
58,916 KB
testcase_34 AC 197 ms
58,556 KB
testcase_35 AC 204 ms
59,192 KB
testcase_36 AC 217 ms
60,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder239 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        
        String[][] a = new String[n][n];
        for (int i = 0; i < n; i++) {
        	for (int j = 0; j < n; j++) {
        		a[i][j] = sc.next();
        	}
        }

        int ret = -1;
        for (int i = 0; i < n; i++) {
        	boolean flag = true;
        	for (int j = 0; j < n; j++) {
        		if (j != i && !a[j][i].equals("nyanpass")) {
        			flag = false;
        			break;
        		}
        	}
        	if (flag && ret == -1) {
        		ret = i + 1;
        	} else if (flag && ret != -1) {
        		ret = -1;
        		break;
        	}
        }

        System.out.println(ret);
        
        sc.close();
    }
}
0