結果
問題 | No.239 にゃんぱすー |
ユーザー | crazybbb3 |
提出日時 | 2017-01-31 22:06:12 |
言語 | Java19 (openjdk 21) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 2,262 bytes |
コンパイル時間 | 1,893 ms |
コンパイル使用メモリ | 75,448 KB |
実行使用メモリ | 53,956 KB |
最終ジャッジ日時 | 2023-08-25 16:36:17 |
合計ジャッジ時間 | 5,618 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
49,460 KB |
testcase_01 | AC | 39 ms
49,412 KB |
testcase_02 | AC | 39 ms
49,588 KB |
testcase_03 | AC | 39 ms
49,488 KB |
testcase_04 | AC | 43 ms
49,356 KB |
testcase_05 | AC | 39 ms
49,516 KB |
testcase_06 | AC | 40 ms
49,936 KB |
testcase_07 | AC | 39 ms
49,516 KB |
testcase_08 | AC | 41 ms
49,560 KB |
testcase_09 | AC | 42 ms
49,512 KB |
testcase_10 | AC | 43 ms
49,484 KB |
testcase_11 | AC | 46 ms
51,056 KB |
testcase_12 | AC | 49 ms
50,528 KB |
testcase_13 | AC | 52 ms
50,552 KB |
testcase_14 | AC | 56 ms
52,116 KB |
testcase_15 | AC | 58 ms
52,036 KB |
testcase_16 | AC | 60 ms
51,780 KB |
testcase_17 | AC | 61 ms
51,592 KB |
testcase_18 | AC | 63 ms
51,828 KB |
testcase_19 | AC | 69 ms
51,896 KB |
testcase_20 | AC | 71 ms
52,048 KB |
testcase_21 | AC | 72 ms
52,120 KB |
testcase_22 | AC | 81 ms
52,112 KB |
testcase_23 | AC | 89 ms
52,636 KB |
testcase_24 | AC | 89 ms
52,072 KB |
testcase_25 | AC | 80 ms
53,148 KB |
testcase_26 | AC | 80 ms
52,288 KB |
testcase_27 | AC | 41 ms
49,444 KB |
testcase_28 | AC | 43 ms
49,704 KB |
testcase_29 | AC | 48 ms
50,536 KB |
testcase_30 | AC | 59 ms
52,388 KB |
testcase_31 | AC | 59 ms
52,080 KB |
testcase_32 | AC | 63 ms
53,956 KB |
testcase_33 | AC | 68 ms
52,180 KB |
testcase_34 | AC | 79 ms
52,124 KB |
testcase_35 | AC | 89 ms
52,728 KB |
testcase_36 | AC | 91 ms
52,368 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.StringTokenizer; public class Main { void solve() throws IOException { int n = ni(); String[][] a = new String[n][]; for (int i = 0; i < n; i++) { a[i] = nsa(n); } ArrayList<Integer> list = new ArrayList<>(); for (int i = 0; i < n; i++) { boolean flg = true; for (int j = 0; j < n; j++) { if (i == j) continue; if (!a[j][i].equals("nyanpass")) { flg = false; break; } } if (flg) list.add(i + 1); } if (list.size() == 1) { out.println(list.get(0)); } else { out.println(-1); } } String ns() throws IOException { while (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine(), " "); } return tok.nextToken(); } int ni() throws IOException { return Integer.parseInt(ns()); } long nl() throws IOException { return Long.parseLong(ns()); } double nd() throws IOException { return Double.parseDouble(ns()); } String[] nsa(int n) throws IOException { String[] res = new String[n]; for (int i = 0; i < n; i++) { res[i] = ns(); } return res; } int[] nia(int n) throws IOException { int[] res = new int[n]; for (int i = 0; i < n; i++) { res[i] = ni(); } return res; } long[] nla(int n) throws IOException { long[] res = new long[n]; for (int i = 0; i < n; i++) { res[i] = nl(); } return res; } static BufferedReader in; static PrintWriter out; static StringTokenizer tok; public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); tok = new StringTokenizer(""); Main main = new Main(); main.solve(); out.close(); } }