結果

問題 No.1170 Never Want to Walk
ユーザー 抹茶アイス抹茶アイス
提出日時 2023-07-20 10:18:05
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,319 bytes
コンパイル時間 17,502 ms
コンパイル使用メモリ 158,656 KB
実行使用メモリ 149,428 KB
最終ジャッジ日時 2023-10-20 11:31:34
合計ジャッジ時間 26,627 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
32,804 KB
testcase_01 AC 83 ms
32,748 KB
testcase_02 AC 82 ms
32,748 KB
testcase_03 AC 82 ms
32,748 KB
testcase_04 AC 82 ms
32,748 KB
testcase_05 AC 81 ms
32,612 KB
testcase_06 AC 83 ms
32,756 KB
testcase_07 AC 82 ms
32,748 KB
testcase_08 AC 82 ms
32,748 KB
testcase_09 AC 80 ms
32,612 KB
testcase_10 AC 82 ms
32,748 KB
testcase_11 AC 82 ms
32,744 KB
testcase_12 WA -
testcase_13 TLE -
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 を復元しました (111 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
/home/judge/data/code/Main.cs(11,13): warning CS0168: 変数 'l' は宣言されていますが、使用されていません [/home/judge/data/code/main.csproj]
  main -> /home/judge/data/code/bin/Release/net7.0/main.dll
  main -> /home/judge/data/code/bin/Release/net7.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
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,k,l;
		var x = new int[n];
		for(i=0;i<n;i++){
		    x[i] = int.Parse(line[i]);
		}
		var s = new List<List <int>>();
		for(i=0;i<n-1;i++){
		    for(j=i+1;j<n;j++){
		        k = Math.Abs(x[i]-x[j]);
		        if(k>=a&&k<=b){
		            var t = new List<int>{x[i],x[j]};
		            s.Add(t);
		        }
		    }
		}
		var u = new List<List<int>>();
		for(i=0;i<s.Count-1;i++){
		    for(j=i+1;j<s.Count;j++){
		        if(s[i].Any(value => value == s[j][0]||value == s[j][1])){
		            s[i].AddRange(s[j]);
		            u.Add(s[j]);
		        }
		    }
		}
		for(i=0;i<u.Count;i++){
		    s.Remove(u[i]);
		}
		for(i=0;i<n;i++){
		    var c = true;
		    for(j=0;j<s.Count;j++){
		        if(s[j].Any(value => value == x[i])){
		            IEnumerable<int> r = s[j].Distinct();
		            var num = new List<int>(r);
		            Console.WriteLine(num.Count);
		            c = false;
		            break;
		        }
		    }
		    if(c){
		        Console.WriteLine(1);
		    }
		}
    }
}
0