結果

問題 No.2652 [Cherry 6th Tune N] Δρονε χιρχλινγ
ユーザー 👑 kakel-sankakel-san
提出日時 2024-02-23 23:03:11
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 473 ms / 2,000 ms
コード長 1,488 bytes
コンパイル時間 9,152 ms
コンパイル使用メモリ 158,376 KB
実行使用メモリ 227,580 KB
最終ジャッジ日時 2024-02-23 23:04:05
合計ジャッジ時間 45,069 ms
ジャッジサーバーID
(参考情報)
judge16 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
33,060 KB
testcase_01 AC 367 ms
76,748 KB
testcase_02 AC 343 ms
76,452 KB
testcase_03 AC 345 ms
76,060 KB
testcase_04 AC 322 ms
80,588 KB
testcase_05 AC 333 ms
81,432 KB
testcase_06 AC 354 ms
82,992 KB
testcase_07 AC 370 ms
83,412 KB
testcase_08 AC 407 ms
84,500 KB
testcase_09 AC 418 ms
86,552 KB
testcase_10 AC 379 ms
80,668 KB
testcase_11 AC 432 ms
77,972 KB
testcase_12 AC 351 ms
81,676 KB
testcase_13 AC 394 ms
84,116 KB
testcase_14 AC 378 ms
78,288 KB
testcase_15 AC 405 ms
83,736 KB
testcase_16 AC 356 ms
82,700 KB
testcase_17 AC 398 ms
81,992 KB
testcase_18 AC 440 ms
87,860 KB
testcase_19 AC 405 ms
82,948 KB
testcase_20 AC 381 ms
78,480 KB
testcase_21 AC 367 ms
78,728 KB
testcase_22 AC 391 ms
78,604 KB
testcase_23 AC 408 ms
78,600 KB
testcase_24 AC 412 ms
78,476 KB
testcase_25 AC 365 ms
78,724 KB
testcase_26 AC 373 ms
78,600 KB
testcase_27 AC 409 ms
78,492 KB
testcase_28 AC 365 ms
78,604 KB
testcase_29 AC 473 ms
78,608 KB
testcase_30 AC 410 ms
78,724 KB
testcase_31 AC 395 ms
78,724 KB
testcase_32 AC 376 ms
78,596 KB
testcase_33 AC 389 ms
78,600 KB
testcase_34 AC 408 ms
78,724 KB
testcase_35 AC 435 ms
78,600 KB
testcase_36 AC 381 ms
78,596 KB
testcase_37 AC 370 ms
78,596 KB
testcase_38 AC 458 ms
78,596 KB
testcase_39 AC 392 ms
78,724 KB
testcase_40 AC 359 ms
77,452 KB
testcase_41 AC 380 ms
227,580 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (102 ms)。
MSBuild のバージョン 17.7.3+8ec440e68 (.NET)
  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 static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var t = NN;
        var ans = new List<string>();
        for (var u = 0; u < t; ++u)
        {
            var c = NList;
            var (n, l) = (c[0], c[1]);
            var map = NArr(n);
            ans.AddRange(Drone(n, l, map));
        }
        WriteLine(string.Join("\n", ans));
    }
    static List<string> Drone(int n, int l, int[][] map)
    {
        var div = (int)Math.Sqrt(n);
        var width = (l + div) / div;
        var list = new List<int[]>[div];
        for (var i = 0; i < list.Length; ++i) list[i] = new List<int[]>();
        for (var i = 0; i < n; ++i)
        {
            list[map[i][1] / width].Add(map[i]);
        }
        for (var i = 0; i < list.Length; ++i)
        {
            if (i % 2 == 0) list[i].Sort((l, r) => l[0].CompareTo(r[0]));
            else list[i].Sort((l, r) => r[0].CompareTo(l[0]));
        }
        var ans = new List<string>{ n.ToString() };
        foreach (var li in list) foreach (var m in li) ans.Add($"{m[0]} {m[1]}");
        return ans;
    }
}
0