結果

問題 No.1170 Never Want to Walk
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-26 10:32:58
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,162 bytes
コンパイル時間 7,344 ms
コンパイル使用メモリ 169,920 KB
実行使用メモリ 449,148 KB
最終ジャッジ日時 2024-04-12 11:01:24
合計ジャッジ時間 13,732 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
33,024 KB
testcase_01 AC 49 ms
36,488 KB
testcase_02 WA -
testcase_03 AC 49 ms
29,312 KB
testcase_04 WA -
testcase_05 AC 48 ms
29,312 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 49 ms
29,568 KB
testcase_10 AC 50 ms
29,440 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (93 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

namespace yukicoder
{
	public class Program
	{
		public static void Main()
		{
			var line = Console.ReadLine().Split(' ');
			var n = int.Parse(line[0]);
			var a = int.Parse(line[1]);
			var b = int.Parse(line[2]);
			line = Console.ReadLine().Split(' ');
			int i, j;
			var x = new int[n];
			var c = new int[n];
			var sum = new int[n];
			for (i = 0; i < n; i++)
			{
				x[i] = int.Parse(line[i]);
				c[i] = -1;
			}
			for (i = 0; i < n; i++)
			{
				if (c[i] == -1)
				{
					var q = new Queue<int>();
					q.Enqueue(i);
					while (q.Count > 0)
					{
						var m = q.Dequeue();
						c[m] = i;
						sum[i]++;
						for (j = 1; m + j < n && Math.Abs(x[m + j] - x[m]) <= b; j++)
						{
							if (Math.Abs(x[m + j] - x[m]) >= a && c[m + j] == -1)
							{
								q.Enqueue(m + j);
							}
						}
						for (j = 1; m - j > 0 && Math.Abs(x[m - j] - x[m]) <= b; j++)
						{
							if (Math.Abs(x[m - j] - x[m]) >= a && c[m - j] == -1)
							{
								q.Enqueue(m - j);
							}
						}
					}
				}
			}
			foreach (var z in c)
			{
				Console.WriteLine(sum[z]);
			}
		}
	}
}
0