結果

問題 No.59 鉄道の旅
ユーザー NoNo
提出日時 2017-05-19 01:47:57
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 777 bytes
コンパイル時間 902 ms
コンパイル使用メモリ 110,584 KB
実行使用メモリ 25,052 KB
最終ジャッジ日時 2023-10-18 23:17:44
合計ジャッジ時間 8,307 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
25,032 KB
testcase_01 AC 28 ms
25,052 KB
testcase_02 AC 28 ms
25,040 KB
testcase_03 AC 28 ms
25,040 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split();
            int n = int.Parse(ss[0]);
            int k = int.Parse(ss[1]);
            var li = new List<int>();

            while (n > 0)
            {
                int w = int.Parse(Console.ReadLine());
                if (w > 0)
                {
                    if (li.Count(x => x >= w) < k) li.Add(w);
                }
                else
                {
                    li.Remove(w * -1);
                }
                n--;
            }

            Console.WriteLine(li.Count);
            Console.ReadLine();
        }
    }
}
0