結果

問題 No.769 UNOシミュレータ
コンテスト
ユーザー 👑 kakel-san
提出日時 2026-10-01 21:24:42
言語 C#
(.NET 10.0.400 + ACL)
コンパイル:
dotnet_c
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 70 ms / 2,000 ms
+ 251µs
コード長 2,598 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 9,936 ms
コンパイル使用メモリ 172,072 KB
実行使用メモリ 49,892 KB
最終ジャッジ日時 2026-10-01 21:24:58
合計ジャッジ時間 13,653 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (212 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net10.0/main.dll
  main -> /home/judge/data/code/bin/Release/net10.0/publish/

ソースコード

diff #
raw source code

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 string[] SList(long n) => Enumerable.Repeat(0, (int)n).Select(_ => ReadLine()).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, m) = (c[0], c[1]);
        var s = SList(m);
        var list = new List<(string, int)>();
        var order = 1;
        var cur = 0;
        var num = new int[n];
        var d2 = 0;
        var d4 = 0;
        for (var i = 0; i < m; ++i)
        {
            if (d2 > 0)
            {
                if (s[i] == "drawtwo")
                {
                    --num[cur];
                    if (i + 1 == m) break;
                    cur = (cur + order + n) % n;
                    ++d2;
                    continue;
                }
                else
                {
                    num[cur] += d2 * 2;
                    cur = (cur + order + n) % n;
                    d2 = 0;
                }
            }
            if (d4 > 0)
            {
                if (s[i] == "drawfour")
                {
                    --num[cur];
                    if (i + 1 == m) break;
                    cur = (cur + order + n) % n;
                    ++d4;
                    continue;
                }
                else
                {
                    num[cur] += d4 * 4;
                    cur = (cur + order + n) % n;
                    d4 = 0;
                }
            }
            if (i + 1 == m)
            {
                --num[cur];
                break;
            }
            if (s[i] == "number")
            {
                --num[cur];
                cur = (cur + order + n) % n;
            }
            else if (s[i] == "drawtwo")
            {
                --num[cur];
                cur = (cur + order + n) % n;
                ++d2;
            }
            else if (s[i] == "drawfour")
            {
                --num[cur];
                cur = (cur + order + n) % n;
                ++d4;
            }
            else if (s[i] == "skip")
            {
                --num[cur];
                cur = (cur + order * 2 + n) % n;
            }
            else
            {
                --num[cur];
                order = -order;
                cur = (cur + order + n) % n;
            }
        }
        WriteLine($"{cur + 1} {-num[cur]}");
    }
}
0