結果

問題 No.239 にゃんぱすー
ユーザー mits58mits58
提出日時 2016-07-02 16:20:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 1,737 ms
コンパイル使用メモリ 74,508 KB
実行使用メモリ 58,476 KB
最終ジャッジ日時 2024-04-20 05:53:16
合計ジャッジ時間 8,380 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 110 ms
54,044 KB
testcase_01 AC 105 ms
53,772 KB
testcase_02 AC 105 ms
53,920 KB
testcase_03 AC 93 ms
52,532 KB
testcase_04 AC 108 ms
54,188 KB
testcase_05 AC 108 ms
54,028 KB
testcase_06 AC 101 ms
53,040 KB
testcase_07 AC 115 ms
54,064 KB
testcase_08 AC 120 ms
53,808 KB
testcase_09 AC 116 ms
54,160 KB
testcase_10 AC 120 ms
54,056 KB
testcase_11 AC 143 ms
53,904 KB
testcase_12 AC 150 ms
54,276 KB
testcase_13 AC 148 ms
54,372 KB
testcase_14 AC 155 ms
54,336 KB
testcase_15 AC 157 ms
54,372 KB
testcase_16 AC 160 ms
54,388 KB
testcase_17 AC 161 ms
54,340 KB
testcase_18 AC 177 ms
56,456 KB
testcase_19 AC 165 ms
56,784 KB
testcase_20 AC 172 ms
56,936 KB
testcase_21 AC 179 ms
56,892 KB
testcase_22 AC 185 ms
57,236 KB
testcase_23 AC 186 ms
56,860 KB
testcase_24 AC 200 ms
57,844 KB
testcase_25 AC 214 ms
57,620 KB
testcase_26 AC 196 ms
58,476 KB
testcase_27 AC 115 ms
54,140 KB
testcase_28 AC 127 ms
54,260 KB
testcase_29 AC 152 ms
54,344 KB
testcase_30 AC 151 ms
54,504 KB
testcase_31 AC 157 ms
54,368 KB
testcase_32 AC 156 ms
56,704 KB
testcase_33 AC 168 ms
56,676 KB
testcase_34 AC 182 ms
56,936 KB
testcase_35 AC 184 ms
58,048 KB
testcase_36 AC 199 ms
58,192 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			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 ans=0;
			for(int i=0;i<n;i++){
				boolean r=true;
				for(int j=0;j<n;j++) if(i!=j && !a[j][i].equals("nyanpass")) r=false;
				if(ans==-1) break;
				else if(r && ans==0) ans=(i+1);
				else if(r) ans=-1;
			}
			System.out.println(ans<=0 ? -1 : ans);
		}
	}
}
0