結果

問題 No.239 にゃんぱすー
ユーザー nak2yoshi
提出日時 2016-02-24 17:07:24
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 494 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 111,872 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-12 03:04:02
合計ジャッジ時間 2,532 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio,
       std.conv,
       std.string,
       std.range,
       std.math,
       std.algorithm;

void main()
{
    auto N = readln.strip.to!int;
    auto A = stdin.byLineCopy.map!split.array;

    int[] ans;
    foreach (j; 0 .. N)
    {
        int count;
        foreach (i; 0 .. N)
        {
            if (A[i][j] == "nyanpass")
                count++;
        }
        if (count == N - 1)
            ans ~= j + 1;
    }
    (ans.length == 1 ? ans.front : -1).writeln;
}
0