C#C
C#3y ago
Spekulant

❔ just a quick help

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static void Main(string[] args) {
        string[] input = Console.ReadLine().Split("  ");
        int[] limits = input[0].Split().Select(int.Parse).ToArray();
        int[] initial = input[1].Split().Select(int.Parse).ToArray();


        int m = limits.Max();
        List<int> res = new List<int>();
        List<int> resMoves = new List<int>();

        for (int i = 0; i <= m; i++) {
            int[] cur = initial.ToArray();
            Queue<int[]> queue = new Queue<int[]>();
            queue.Enqueue(cur);
            Queue<int> depth = new Queue<int>();
            depth.Enqueue(0);

            List<int[]> history = new List<int[]>();

            while (queue.Count > 0) {
                cur = queue.Dequeue();
                history.Add(cur);
                int curDepth = depth.Dequeue();

                if (cur.Contains(i)) {
                    res.Add(i);
                    resMoves.Add(curDepth);
                    break;
                }
Was this page helpful?