結果

問題 No.714 回転寿司屋のシミュレート
コンテスト
ユーザー 👑 kakel-san
提出日時 2026-10-15 23:08:56
言語 C#
(.NET 10.0.402 + ACL)
コンパイル:
dotnet_c
実行:
/usr/bin/dotnet_wrap
結果
AC  
実行時間 57 ms / 2,000 ms
+ 697µs
コード長 1,657 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,509 ms
コンパイル使用メモリ 170,300 KB
実行使用メモリ 38,656 KB
最終ジャッジ日時 2026-10-15 23:09:08
合計ジャッジ時間 9,287 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (167 ミリ秒)。
  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();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var seats = new Dictionary<string, int>[21];
        for (var i = 0; i < seats.Length; ++i) seats[i] = new Dictionary<string, int>();
        var ans = new List<int>();
        for (var i = 0; i < n; ++i)
        {
            var s = ReadLine().Split();
            if (s[0] == "0")
            {
                var si = int.Parse(s[1]);
                for (var j = 3; j < s.Length; ++j)
                {
                    if (seats[si].ContainsKey(s[j])) ++seats[si][s[j]];
                    else seats[si][s[j]] = 1;
                }
            }
            else if (s[0] == "1")
            {
                var flg = false;
                for (var j = 1; j < seats.Length; ++j)
                {
                    if (seats[j].ContainsKey(s[1]) && seats[j][s[1]] > 0)
                    {
                        ans.Add(j);
                        --seats[j][s[1]];
                        flg = true;
                        break;
                    }
                }
                if (!flg) ans.Add(-1);
            }
            else
            {
                var si = int.Parse(s[1]);
                seats[si] = new Dictionary<string, int>();
            }
        }
        WriteLine(string.Join("\n", ans));
    }
}
0