結果

問題 No.1935 Water Simulation
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-18 23:43:57
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 1,206 bytes
コンパイル時間 14,412 ms
コンパイル使用メモリ 158,556 KB
実行使用メモリ 178,144 KB
最終ジャッジ日時 2023-10-18 23:44:17
合計ジャッジ時間 20,105 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
32,676 KB
testcase_01 AC 82 ms
32,684 KB
testcase_02 AC 83 ms
32,664 KB
testcase_03 AC 82 ms
32,668 KB
testcase_04 AC 81 ms
32,668 KB
testcase_05 AC 81 ms
32,668 KB
testcase_06 AC 82 ms
32,664 KB
testcase_07 AC 82 ms
32,668 KB
testcase_08 AC 83 ms
32,668 KB
testcase_09 AC 83 ms
32,668 KB
testcase_10 AC 82 ms
32,668 KB
testcase_11 AC 83 ms
32,664 KB
testcase_12 AC 89 ms
32,664 KB
testcase_13 AC 84 ms
32,668 KB
testcase_14 AC 83 ms
32,668 KB
testcase_15 AC 82 ms
32,664 KB
testcase_16 AC 88 ms
32,664 KB
testcase_17 AC 84 ms
32,664 KB
testcase_18 AC 84 ms
32,660 KB
testcase_19 AC 82 ms
32,660 KB
testcase_20 AC 84 ms
32,660 KB
testcase_21 AC 83 ms
32,664 KB
testcase_22 AC 82 ms
32,664 KB
testcase_23 AC 81 ms
32,664 KB
testcase_24 AC 97 ms
32,664 KB
testcase_25 AC 82 ms
32,664 KB
testcase_26 AC 80 ms
32,664 KB
testcase_27 AC 81 ms
32,664 KB
testcase_28 AC 82 ms
32,664 KB
testcase_29 AC 82 ms
32,664 KB
testcase_30 AC 82 ms
32,664 KB
testcase_31 AC 82 ms
178,144 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (109 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 long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var v = new long[]{ c[0], 0, 0, 0 };
        var m = c.Take(4).ToArray();
        var dp = new long[][] { v.ToArray(), new long[4], new long[4], new long[4] };
        for (var i = 0; i < c[4]; ++i)
        {
            var next = Move(dp[i % 4], m, i % 4, (i + 1) % 4);
            var flg = true;
            for (var j = 0; j < 4; ++j) if (next[j] != dp[(i + 1) % 4][j])
            {
                flg = false;
                break;
            }
            if (flg) break;
            dp[(i + 1) % 4] = next;
        }
        WriteLine(string.Join(" ", dp[(int)(c[4] % 4)]));
    }
    static long[] Move(long[] v, long[] m, int f, int t)
    {
        var ans = v.ToArray();
        var move = Math.Min(v[f], m[t] - v[t]);
        ans[f] -= move;
        ans[t] += move;
        return ans;
    }
}
0