█████████ ████ ███░░░░░███ ░░███ ███ ░░░ ██████ ███████ ██████ ██████ ░███ ███░░███ ███░░███ ███░░███ ███░░███ ░███ ░███ ░███░███ ░███ ░███████ ░███ ░███ ░░███ ███░███ ░███░███ ░███ ░███░░░ ░███ ░███ ░░█████████ ░░██████ ░░████████░░██████ ░░██████ ░░░░░░░░░ ░░░░░░ ░░░░░░░░ ░░░░░░ ░░░░░░

Envío 7209

Problema 0xcf - Mirando al horizonte

  • Autor: Prueba
  • Fecha: 2023-11-26 04:00:38 UTC (Hace 6 meses)
Caso # Resultado Tiempo Memoria
#1
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#2
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#3
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#4
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#5
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#6
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#7
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#8
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#9
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
#10
Error de compilación
                      Main.cs(1,7): error CS1525: Unexpected symbol `void', expecting `class', `delegate', `enum', `interface', `partial', `ref', or `struct'
Compilation failed: 1 error(s), 0 warnings

                    
Puntos totales: 0 / 100

Código

static void Main(string[] args)
    {
        int cases = int.Parse(Console.ReadLine());
        for (int c = 1; c <= cases; ++c)
        {
            Console.Write("Case #" + c + ":");
            Solve();
        }
    }

    static void Solve()
    {
        int n = int.Parse(Console.ReadLine());
        int[] a = new int[n];
        for (int i = 0; i < n; ++i)
        {
            a[i] = int.Parse(Console.ReadLine());
        }
        LinkedList<int> q = new LinkedList<int>();
        int[] answer = new int[n];
        for (int i = n - 1; i >= 0; --i)
        {
            while (q.Count > 0 && a[i] >= q.First.Value)
            {
                q.RemoveFirst();
            }
            answer[i] = q.Count == 0 ? -1 : q.First.Value;
            q.AddFirst(a[i]);
        }
        for (int i = 0; i < n; ++i)
        {
            Console.Write(" " + answer[i]);
        }
        Console.WriteLine();
    }