結果

問題 No.2482 Sandglasses
ユーザー 👑 kakel-sankakel-san
提出日時 2023-09-25 22:07:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 1,258 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 108,416 KB
実行使用メモリ 52,404 KB
最終ジャッジ日時 2024-04-28 09:05:03
合計ジャッジ時間 13,203 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
19,328 KB
testcase_01 AC 33 ms
19,328 KB
testcase_02 AC 34 ms
19,328 KB
testcase_03 AC 344 ms
52,276 KB
testcase_04 AC 345 ms
52,272 KB
testcase_05 AC 337 ms
52,144 KB
testcase_06 AC 344 ms
52,404 KB
testcase_07 AC 344 ms
52,280 KB
testcase_08 AC 339 ms
52,160 KB
testcase_09 AC 345 ms
52,268 KB
testcase_10 AC 342 ms
52,268 KB
testcase_11 AC 346 ms
52,396 KB
testcase_12 AC 347 ms
52,272 KB
testcase_13 AC 344 ms
52,288 KB
testcase_14 AC 341 ms
52,156 KB
testcase_15 AC 340 ms
52,276 KB
testcase_16 AC 350 ms
52,012 KB
testcase_17 AC 349 ms
52,144 KB
testcase_18 AC 344 ms
52,144 KB
testcase_19 AC 345 ms
52,272 KB
testcase_20 AC 351 ms
52,144 KB
testcase_21 AC 347 ms
52,272 KB
testcase_22 AC 349 ms
52,272 KB
testcase_23 AC 340 ms
52,180 KB
testcase_24 AC 319 ms
52,320 KB
testcase_25 AC 341 ms
52,324 KB
testcase_26 AC 319 ms
52,320 KB
testcase_27 AC 337 ms
52,316 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 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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, k, t) = (c[0], c[1], c[2]);
        var a = ReadLine().Split();
        var b = NList;
        var clocks = new List<(int id, int dir, int pos)>(n);
        for (var i = 0; i < n; ++i)
        {
            clocks.Add((i, a[i] == "A" ? -1 : 1, b[i]));
        }
        clocks.Sort((l, r) => l.pos.CompareTo(r.pos));
        var after = new List<int>(n);
        for (var i = 0; i < n; ++i)
        {
            after.Add(GetPos(clocks[i].pos, clocks[i].dir, k, t));
        }
        after.Sort();
        var ans = new int[n];
        for (var i = 0; i < n; ++i) ans[clocks[i].id] = after[i];
        WriteLine(string.Join(" ", ans));
    }
    static int GetPos(int begin, int dir, int len, int time)
    {
        var after = Math.Abs((begin + dir * time) % (len * 2));
        if (after > len) return 2 * len - after;
        else return after;
    }
}
0