結果
| 問題 | No.59 鉄道の旅 | 
| コンテスト | |
| ユーザー |  No | 
| 提出日時 | 2017-05-19 01:47:57 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                TLE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 777 bytes | 
| コンパイル時間 | 2,032 ms | 
| コンパイル使用メモリ | 106,368 KB | 
| 実行使用メモリ | 27,520 KB | 
| 最終ジャッジ日時 | 2024-09-18 19:16:29 | 
| 合計ジャッジ時間 | 8,699 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | TLE * 1 -- * 11 | 
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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();
        }
    }
}
            
            
            
        