結果

問題 No.3291 K-step Navigation
ユーザー pengin_2000
提出日時 2025-10-03 22:31:07
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 580 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 27,084 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-03 22:31:20
合計ジャッジ時間 1,625 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 42 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%lld %lld %lld", &n, &m, &k);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%lld %lld", &s, &t);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:14:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%lld %lld", &u[i], &v[i]);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
long long int u[4003], v[4003];
int main()
{
	long long int n, m, k;
	scanf("%lld %lld %lld", &n, &m, &k);
	long long int s, t;
	scanf("%lld %lld", &s, &t);
	s--;
	t--;
	long long int i;
	for (i = 0; i < m; i++)
	{
		scanf("%lld %lld", &u[i], &v[i]);
		u[i + m] = --v[i];
		v[i + m] = --u[i];
	}
	m *= 2;
	if (k % 2 > 0)
	{
		printf("Yes\n");
		return 0;
	}
	long long int cnt = 0;
	for (i = 0; i < m; i++)
	{
		if (u[i] == s && v[i] != t)
			cnt++;
		if (u[i] == t && v[i] != s)
			cnt++;
	}
	if (cnt > 0)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}
0