結果

問題 No.1454 ツブ消ししとるなEasy
ユーザー AAAAAA
提出日時 2021-03-31 21:38:01
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,491 bytes
コンパイル時間 934 ms
コンパイル使用メモリ 110,820 KB
実行使用メモリ 55,392 KB
最終ジャッジ日時 2024-12-15 16:09:31
合計ジャッジ時間 5,356 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13 WA * 2 TLE * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp190
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            int x = int.Parse(str[2]);
            int y = int.Parse(str[3]);
            int nokori = n;
            int kesu = 0;
            long sum = 0;
            long[] a = new long[n];
            string[] str2 = Console.ReadLine().Split();
            for(int i = 0; i < n; i++)
            {
                a[i] = int.Parse(str2[i]);
            }
            for(int i = 0; i < n; i++)
            {
                if (a[i] <= y)
                {
                    nokori -= 1;
                    a[i] = 1000000;
                    kesu += 1;
                }
            }
            while (a.Min() < x&&nokori>m)
            {
                nokori -= 1;
                a[Array.IndexOf(a,a.Min())] = 1000000;
                kesu += 1;
            }
            if (nokori>m)
            {
                Console.WriteLine("Handicapped");
            }
            else
            {
                for(int i = 0; i < n; i++)
                {
                    sum += a[i];
                }
                Console.WriteLine(sum-(kesu*1000000));
            }
            Console.ReadLine();
        }
    }
}
0