結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
55,732 KB
testcase_01 AC 131 ms
55,704 KB
testcase_02 AC 131 ms
55,540 KB
testcase_03 AC 129 ms
56,024 KB
testcase_04 AC 129 ms
55,888 KB
testcase_05 AC 129 ms
55,568 KB
testcase_06 AC 128 ms
55,440 KB
testcase_07 AC 130 ms
55,832 KB
testcase_08 AC 129 ms
56,000 KB
testcase_09 AC 132 ms
55,972 KB
testcase_10 AC 140 ms
55,592 KB
testcase_11 AC 146 ms
55,920 KB
testcase_12 AC 143 ms
55,840 KB
testcase_13 AC 165 ms
55,968 KB
testcase_14 AC 169 ms
55,840 KB
testcase_15 AC 170 ms
55,688 KB
testcase_16 AC 168 ms
55,788 KB
testcase_17 AC 186 ms
55,776 KB
testcase_18 AC 185 ms
56,076 KB
testcase_19 AC 207 ms
55,920 KB
testcase_20 AC 212 ms
56,804 KB
testcase_21 AC 215 ms
56,284 KB
testcase_22 AC 219 ms
56,736 KB
testcase_23 AC 226 ms
58,952 KB
testcase_24 AC 224 ms
58,932 KB
testcase_25 AC 226 ms
58,904 KB
testcase_26 AC 230 ms
58,496 KB
testcase_27 AC 130 ms
55,628 KB
testcase_28 AC 140 ms
55,884 KB
testcase_29 AC 146 ms
55,956 KB
testcase_30 AC 170 ms
56,012 KB
testcase_31 AC 172 ms
55,928 KB
testcase_32 AC 186 ms
55,764 KB
testcase_33 AC 214 ms
56,600 KB
testcase_34 AC 223 ms
56,328 KB
testcase_35 AC 224 ms
58,172 KB
testcase_36 AC 238 ms
58,576 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