結果

問題 No.714 回転寿司屋のシミュレート
ユーザー bluemegane
提出日時 2018-09-24 19:23:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 2,000 ms
コード長 1,150 bytes
コンパイル時間 822 ms
コンパイル使用メモリ 112,544 KB
実行使用メモリ 29,064 KB
最終ジャッジ日時 2024-09-22 16:30:11
合計ジャッジ時間 3,355 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System.Collections.Generic;
using System;

public class Hello
{
    public static void Main()
    {
        var c = new List<string>[20];
        for (int i = 0; i < 20; i++) c[i] = new List<string>();
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            if (line[0] == "0")
            {
                var n1 = int.Parse(line[1]) - 1;
                var m1 = int.Parse(line[2]);
                for (int j = 0; j < m1; j++)
                    c[n1].Add(line[j + 3]);
            }
            else if (line[0] == "1")
            {
                var neta = line[1];
                var deleted = false;
                for (int j = 0; j < 20; j++)
                    if (c[j].Count() > 0 && c[j].Contains(neta)) { c[j].Remove(neta); deleted = true; Console.WriteLine(j + 1); break; }
                if (!deleted) Console.WriteLine(-1);
            }
            else
            {
                var a = int.Parse(line[1]) - 1;
                c[a].Clear();
            }
        }
    }
}
0