結果
問題 | No.239 にゃんぱすー |
ユーザー |
![]() |
提出日時 | 2015-08-10 21:41:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 240 ms / 2,000 ms |
コード長 | 1,015 bytes |
コンパイル時間 | 3,707 ms |
コンパイル使用メモリ | 80,280 KB |
実行使用メモリ | 46,988 KB |
最終ジャッジ日時 | 2024-07-18 06:34:44 |
合計ジャッジ時間 | 11,635 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import java.util.*; import java.io.*; import java.awt.geom.*; import java.math.*; public class No0239 { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static void solve() { int n = in.nextInt(); String[][] a = new String[n][n]; for (int i=0; i<n; i++) { for (int j=0; j<n; j++) { a[i][j] = in.next(); } } int ans = -2; for (int i=0; i<n; i++) { boolean f = true; for (int j=0; j<n; j++) { if (!a[j][i].equals("-") && !a[j][i].equals("nyanpass")) { f = false; } } if (f) { if (ans == -2) { ans = i+1; }else { ans = -1; } } } out.println(ans < 0 ? "-1" : ans); } public static void main(String[] args) { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); //trace(end-start + "ms"); in.close(); out.close(); } static void trace(Object... o) { System.out.println(Arrays.deepToString(o));} }