結果

問題 No.2353 Guardian Dogs in Spring
ユーザー kakel-san
提出日時 2023-08-09 07:28:10
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 872 bytes
コンパイル時間 912 ms
コンパイル使用メモリ 110,864 KB
実行使用メモリ 29,576 KB
最終ジャッジ日時 2024-11-14 13:47:49
合計ジャッジ時間 8,361 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 40
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

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 n = NN;
        var map = NArr(n).Select((xy, id) => new int[] { xy[0], xy[1], id + 1 }).ToList();
        map.Sort((l, r) =>
        {
            var d = l[0].CompareTo(r[0]);
            if (d != 0) return d;
            return l[1].CompareTo(r[1]);
        });
        WriteLine(n / 2);
        for (var i = 0; i + 1 < n; i += 2)
        {
            WriteLine($"{map[i][2]} {map[i + 1][2]}");
        }
    }
}
0