結果

問題 No.239 にゃんぱすー
コンテスト
ユーザー bal4u
提出日時 2019-04-14 16:47:13
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 937 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 218 ms
コンパイル使用メモリ 38,272 KB
最終ジャッジ日時 2026-02-22 02:57:45
ジャッジサーバーID
(参考情報)
judge4 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

// yukicoder: No.241 出席番号(1)
// 2019.4.14 bal4u
// 最大2部マッチング

#include <stdio.h>
#include <string.h>

//// 高速入力
#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()    // 非負整数の入力
{
	int n = 0, c = gc();
	do n = 10 * n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int ins(char *s)  // 文字列の入力 スペース以下の文字で入力終了
{
	char *p = s;
	do *s = gc();
	while (*s++ > ' ');
	*--s = 0;
	return s - p;
}

#define MYAN "nyanpass"
int N;
char a[105][105][35]; int w[105][105];

int main()
{
	int r, c, id;

	N = in();
	for (r = 0; r < N; r++) for (c = 0; c < N; c++) {
		w[r][c] = ins(a[r][c]);
	}
	id = -1;
	for (c = 0; c < N; c++) {
		for (r = 0; r < N; r++) if (c != r) {
			if (strcmp(MYAN, a[r][c])) break;
		}
		if (r >= N) {
			if (id < 0) id = c + 1;
			else { id = -1; break; }
		}
	}
	printf("%d\n", id);
	return 0;
}
0