結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー 14番
提出日時 2016-05-22 01:54:17
言語 C#(csc)
(csc 3.9.0)
結果
MLE  
実行時間 -
コード長 2,329 bytes
コンパイル時間 1,106 ms
コンパイル使用メモリ 118,624 KB
実行使用メモリ 67,356 KB
最終ジャッジ日時 2024-10-07 06:09:58
合計ジャッジ時間 16,119 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other WA * 6 MLE * 42
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int[] inpt = Reader.ReadLine().Split(' ').Select(a=>int.Parse(a)).ToArray();
        
        long[] aList = Reader.ReadLine().Split(' ').Select(a=>long.Parse(a)).OrderBy(a=>a).ToArray();
        Dictionary<long, int> aCnt = new Dictionary<long, int>();
        aList.ToList().ForEach(a=>{
            if(aCnt.ContainsKey(a)) {
                aCnt[a]++;
            } else
            {
                aCnt.Add(a, 1);
            }
        });
        aList = aCnt.Keys.ToArray();
        
        Dictionary<int, long> bList = new Dictionary<int, long>();
        Reader.ReadLine().Split(' ').Select(a=>long.Parse(a)).ToList().ForEach(b=>bList.Add(bList.Count, b));
        Dictionary<int, int> cList = new Dictionary<int, int>();
        int currentIdx = 0;
        bList.OrderBy(a=>a.Value).ToList().ForEach((a)=>{
            int cnt = 0;
            for(int i=currentIdx; i<aList.Length; i++) {
                currentIdx = i;
                if(aList[i] < a.Value) {
                    // スルー
                } else if(aList[i] == a.Value) {
                    cnt+=aCnt[aList[i]];
                } else
                {
                    break;
                }
            }
            cList[a.Key] = cnt;
        });
        StringBuilder ans = new StringBuilder();
        cList.OrderBy(a=>a.Key).ToList().ForEach(a=>ans.Append(" " + a.Value));
        Console.WriteLine(ans.ToString().Substring(1));
        

    }
    




    

    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"


2 2
0 1000000000000
0 1000000000000


 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0