結果

問題 No.239 にゃんぱすー
ユーザー yuppe19 😺yuppe19 😺
提出日時 2015-09-02 10:50:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 816 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 75,084 KB
実行使用メモリ 58,916 KB
最終ジャッジ日時 2023-09-25 22:07:03
合計ジャッジ時間 10,938 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,052 KB
testcase_01 AC 124 ms
56,044 KB
testcase_02 AC 125 ms
55,828 KB
testcase_03 AC 126 ms
55,552 KB
testcase_04 AC 126 ms
55,696 KB
testcase_05 AC 122 ms
55,740 KB
testcase_06 AC 124 ms
55,580 KB
testcase_07 AC 126 ms
55,672 KB
testcase_08 AC 129 ms
56,188 KB
testcase_09 AC 129 ms
55,676 KB
testcase_10 AC 134 ms
55,856 KB
testcase_11 AC 144 ms
55,724 KB
testcase_12 AC 141 ms
56,072 KB
testcase_13 AC 161 ms
56,204 KB
testcase_14 AC 164 ms
55,568 KB
testcase_15 AC 163 ms
55,988 KB
testcase_16 AC 164 ms
56,108 KB
testcase_17 AC 181 ms
55,988 KB
testcase_18 AC 179 ms
56,040 KB
testcase_19 AC 200 ms
56,036 KB
testcase_20 AC 209 ms
57,072 KB
testcase_21 AC 206 ms
56,776 KB
testcase_22 AC 209 ms
56,532 KB
testcase_23 AC 216 ms
58,240 KB
testcase_24 AC 218 ms
58,748 KB
testcase_25 AC 217 ms
58,916 KB
testcase_26 AC 219 ms
58,572 KB
testcase_27 AC 125 ms
56,212 KB
testcase_28 AC 136 ms
54,040 KB
testcase_29 AC 143 ms
55,652 KB
testcase_30 AC 164 ms
56,024 KB
testcase_31 AC 164 ms
55,464 KB
testcase_32 AC 188 ms
56,660 KB
testcase_33 AC 205 ms
56,624 KB
testcase_34 AC 212 ms
56,328 KB
testcase_35 AC 214 ms
58,656 KB
testcase_36 AC 218 ms
58,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.util.stream.*;

import static java.lang.Math.*;

public class Main {
  private void solve() {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    sc.nextLine();
    String[][] mat = new String[n][n];
    int[] nyan = new int[n];
    for(int r=0; r<n; r++) {
      String line = sc.nextLine();
      String[] sp = line.split(" ");
      for(int c=0; c<n; c++) {
        mat[r][c] = sp[c];
      }
    }
    for(int r=0; r<n; r++) {
      for(int c=0; c<n; c++) {
        if(mat[r][c].equals("nyanpass")) { nyan[c]++; }
      }
    }
    int cnt = 0, res = -1;
    for(int i=0; i<n; i++) {
      if(nyan[i] == n-1) { cnt++; res = i+1; }
    }
    System.out.printf("%d\n", cnt==1?res:-1);
  }

  public static void main(String[] args) {
    new Main().solve();
  }
}
0