46442023-03-30 14:01:53vááááTestnevelés óracsharpWrong answer 0/501.101s138584 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace tesi
{
    class Program
    {
        static List<int>[] b;
        static List<int> c = new List<int>();
        static int d = 0;
        static List<int>[] f = new List<int>[100000];
        static bool eloszor = true;
        static void add(int j)
        {

            d++;
            for (int i = 0; i < b[j].Count; i++)
            {
                if (c.Count() != 0)
                {
                    f[d] = new List<int>();
                    f[d + 1] = new List<int>();
                    f[d].AddRange(c);
                    c.Clear();
                }
                add(b[j][i]);
            }
            if (eloszor)
            {
                f[d] = new List<int>();
                if (d != 0)
                {
                    c.AddRange(f[d]);
                    d--;
                }
            }
            b[j].AddRange(c);
            c.Add(j);
        }
        static void Main(string[] args)
        {
            string[] a = Console.ReadLine().Split();
            int n = int.Parse(a[0])+1, k = int.Parse(a[1]);
            b = new List<int>[n];
            for (int i = 1; i < n; i++)
            {
                b[i] = new List<int>();
            }
            for (int i = 0; i < k; i++)
            {
                a = Console.ReadLine().Split();
                b[int.Parse(a[0])].Add(int.Parse(a[1]));
            }
            for (int i = 1; i < n; i++)
            {
                c.Clear();
                add(i);
            }
            for (int i = 1; i < n; i++)
            {
                c.Clear();
                 c.AddRange(b[i].Distinct().ToList());
                b[i].Clear();
                b[i].AddRange(c);
                b[i].Sort();
                b[i].Add(1);
            }
            int id = -1;
            string ki = "";
            int m = int.MinValue;
            for (int i = 1; i < n; i++)
            {
                m = -1;
                for (int j = 1; j < n; j++)
                {
                    if(m < b[j].Count)
                    {
                        id = j;
                        m = b[j].Count;
                    }
                }
                ki += id + " ";
                b[id].Clear();
            }
            Console.WriteLine("1");
            Console.WriteLine(ki);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/037ms23508 KiB
2Wrong answer0/037ms23908 KiB
3Time limit exceeded0/01.101s19640 KiB
4Wrong answer0/237ms24552 KiB
5Wrong answer0/335ms24660 KiB
6Wrong answer0/337ms25284 KiB
7Wrong answer0/335ms25348 KiB
8Runtime error0/1231ms75600 KiB
9Wrong answer0/339ms27340 KiB
10Time limit exceeded0/31.069s12108 KiB
11Time limit exceeded0/31.042s12292 KiB
12Runtime error0/194ms138584 KiB
13Time limit exceeded0/21.059s12644 KiB
14Time limit exceeded0/31.047s12780 KiB
15Time limit exceeded0/11.062s20124 KiB
16Time limit exceeded0/31.072s49564 KiB
17Time limit exceeded0/51.082s37868 KiB
18Time limit exceeded0/11.077s32800 KiB
19Time limit exceeded0/21.072s20652 KiB
20Runtime error0/3448ms137824 KiB
21Runtime error0/4514ms96060 KiB
22Runtime error0/4419ms136928 KiB