Dzień Dobry, zadanie https://pl.spoj.com/problems/MWPZ06H/
Spoj wyrzuca błąd wykonania (NZEC) - proszę o wskazówkę
using System;
using System.Collections.Generic;
namespace ConsoleApp2
{
class Program
{
static void Main()
{
int D = Convert.ToInt32(Console.ReadLine());
while (D > 0)
{
int N = Convert.ToInt32(Console.ReadLine());
string[] lista = Console.ReadLine().Split(' ');
List<int> listaA = new List<int>(Array.ConvertAll(lista, arrTemp =>
Convert.ToInt32(arrTemp)));
listaA.Sort();
int maxiA = (listaA[N - 1]);
listaA.RemoveAt(N-1);
listaA.Sort();
int maxiB = listaA[listaA.Count - 1];
if (maxiA == maxiB)
{
Console.Write(maxiA + " " + maxiB + " ");
listaA.RemoveAt(listaA.Count - 1);
foreach (var item in listaA)
{
Console.Write(item + " ");
}
Console.WriteLine();
}
else
{
Console.Write(maxiA + " ");
foreach (var item in listaA)
{
Console.Write(item + " ");
}
Console.WriteLine();
}
D--;
}
}
}
}