結果

問題 No.239 にゃんぱすー
ユーザー mits58mits58
提出日時 2016-07-02 16:20:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 204 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 2,095 ms
コンパイル使用メモリ 72,900 KB
実行使用メモリ 60,012 KB
最終ジャッジ日時 2023-08-02 05:58:20
合計ジャッジ時間 9,375 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
56,028 KB
testcase_01 AC 113 ms
55,720 KB
testcase_02 AC 114 ms
56,428 KB
testcase_03 AC 117 ms
55,772 KB
testcase_04 AC 113 ms
56,028 KB
testcase_05 AC 114 ms
56,028 KB
testcase_06 AC 115 ms
55,692 KB
testcase_07 AC 123 ms
55,904 KB
testcase_08 AC 125 ms
56,008 KB
testcase_09 AC 129 ms
55,764 KB
testcase_10 AC 138 ms
56,316 KB
testcase_11 AC 161 ms
56,428 KB
testcase_12 AC 166 ms
56,328 KB
testcase_13 AC 167 ms
56,384 KB
testcase_14 AC 157 ms
56,672 KB
testcase_15 AC 174 ms
57,044 KB
testcase_16 AC 182 ms
56,656 KB
testcase_17 AC 177 ms
58,104 KB
testcase_18 AC 182 ms
58,828 KB
testcase_19 AC 188 ms
58,520 KB
testcase_20 AC 184 ms
58,976 KB
testcase_21 AC 186 ms
58,468 KB
testcase_22 AC 190 ms
59,196 KB
testcase_23 AC 182 ms
59,164 KB
testcase_24 AC 200 ms
59,252 KB
testcase_25 AC 203 ms
60,012 KB
testcase_26 AC 203 ms
59,416 KB
testcase_27 AC 123 ms
55,848 KB
testcase_28 AC 153 ms
56,624 KB
testcase_29 AC 161 ms
56,780 KB
testcase_30 AC 167 ms
56,756 KB
testcase_31 AC 176 ms
56,368 KB
testcase_32 AC 165 ms
56,572 KB
testcase_33 AC 179 ms
58,656 KB
testcase_34 AC 185 ms
59,572 KB
testcase_35 AC 194 ms
59,420 KB
testcase_36 AC 204 ms
59,484 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