結果

問題 No.1373 Directed Operations
ユーザー keymoonkeymoon
提出日時 2021-02-05 21:25:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 4,013 ms
コンパイル使用メモリ 107,980 KB
実行使用メモリ 40,860 KB
最終ジャッジ日時 2023-09-15 07:09:04
合計ジャッジ時間 6,811 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
21,764 KB
testcase_01 AC 66 ms
21,832 KB
testcase_02 AC 155 ms
38,544 KB
testcase_03 AC 127 ms
29,688 KB
testcase_04 AC 135 ms
31,052 KB
testcase_05 AC 66 ms
19,784 KB
testcase_06 AC 178 ms
37,232 KB
testcase_07 AC 79 ms
22,216 KB
testcase_08 AC 87 ms
22,992 KB
testcase_09 AC 158 ms
28,972 KB
testcase_10 AC 145 ms
30,248 KB
testcase_11 AC 93 ms
23,252 KB
testcase_12 AC 142 ms
32,092 KB
testcase_13 AC 83 ms
22,756 KB
testcase_14 AC 188 ms
40,672 KB
testcase_15 AC 175 ms
39,272 KB
testcase_16 AC 186 ms
40,860 KB
testcase_17 AC 146 ms
36,516 KB
testcase_18 AC 117 ms
27,464 KB
testcase_19 AC 116 ms
27,412 KB
testcase_20 AC 131 ms
28,296 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] res = new int[n - 1];
        int cnt = 1;
        foreach (var (elem, ind) in a.Select((elem, ind) => (elem, ind)).OrderBy(x => x.elem))
        {
            if (cnt < elem)
            {
                Console.WriteLine("NO");
                return;
            }
            res[ind] = cnt - elem;
            cnt++;
        }
        Console.WriteLine("YES");
        Console.WriteLine(string.Join("\n", res.Select(x => x + 1)));
    }
}
0