Submission #1208800


Source Code Expand

Copy
#pragma warning disable

using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
// Do not use: System.Numerics;

public class Test
{
    public static void Main()
    {
        int n = Int32.Parse(Console.ReadLine());

        KeyValuePair<char, int>[] dictmax = null;

        for (int i = 0; i < n; i++)
        {
            var line1 = Console.ReadLine();

            var dict = new Dictionary<char, int>();

            foreach (var c in line1)
            {
                if (!dict.ContainsKey(c))
                {
                    dict[c] = 0;
                }

                dict[c]++;
            }

            if (dictmax == null)
            {
                dictmax = dict.OrderBy(x => x.Key).ToArray();
            }
            else
            {
                for (int j = 0; j < dictmax.Length; j++)
                {
                    var kvpair = dictmax[j];

                    if (dict.ContainsKey(kvpair.Key))
                    {
                        dictmax[j] = new KeyValuePair<char, int>(kvpair.Key, Math.Min(kvpair.Value, dict[kvpair.Key]));
                    }
                    else
                    {
                        dictmax[j] = new KeyValuePair<char, int>(kvpair.Key, 0);
                    }
                }
            }

        }

        for (int j = 0; j < dictmax.Length; j++)
        {
            var kvpair = dictmax[j];

            for (int k = 0; k < kvpair.Value; k++)
            {
                Console.Write(kvpair.Key);
            }
        }

        Console.WriteLine();
    }
}

Submission Info

Submission Time
Task C - Dubious Document
User yuinore
Language C# (Mono 4.6.2.0)
Score 300
Code Size 1726 Byte
Status
Exec Time 27 ms
Memory 13280 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_000.txt, 0_001.txt
All 300 / 300 0_000.txt, 0_001.txt, dec_half.txt, hand.txt, max.txt, max_10.txt, max_5.txt, maxx.txt, rnd.txt, single.txt
Case Name Status Exec Time Memory
0_000.txt 26 ms 9184 KB
0_001.txt 26 ms 13280 KB
dec_half.txt 26 ms 9184 KB
hand.txt 26 ms 9184 KB
max.txt 27 ms 13268 KB
max_10.txt 27 ms 11232 KB
max_5.txt 26 ms 9184 KB
maxx.txt 26 ms 9300 KB
rnd.txt 27 ms 11232 KB
single.txt 27 ms 11232 KB