46542023-03-30 14:36:40Leventusz19Váltakozó (75 pont)csharpWrong answer 0/75578ms32740 KiB
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Váltakozó_szöveg{
    class Program{
        static void Main(){
            string in1 = Console.ReadLine();
            char[] c = in1.ToArray();
            bool[] cc = new bool[c.Length];
            string abc = "abcdefghijklmnopqrtsuvwxyz";
            string o1 = "";
            Array.Sort(c);
            for(int i=0, j=0, lj=0; i<c.Length; i++){
                j = i;
                lj = j;
                var ij = false;
                while (i > 0 && o1[i - 1] == c[j] && !cc[j]) if (j == lj && ij) { Console.WriteLine(-1); Console.ReadKey(); return; } else if (!cc[j] && j < c.Length - 1) j++; else if (j == 0) ij = true;else  j=0;
                //while(c[j]==o1[i-1])
                o1 += c[j];
                cc[j] = true;
                //Console.Write(o1[i]);
            }
            Console.WriteLine(o1);
            Console.ReadKey();
        }
    }
}
SubtaskSumTestVerdictTimeMemory
base0/75
1Wrong answer0/029ms20996 KiB
2Wrong answer0/032ms23892 KiB
3Wrong answer0/329ms22244 KiB
4Wrong answer0/328ms21980 KiB
5Wrong answer0/330ms22424 KiB
6Wrong answer0/330ms22948 KiB
7Time limit exceeded0/3572ms30620 KiB
8Time limit exceeded0/3563ms10036 KiB
9Time limit exceeded0/3550ms10200 KiB
10Time limit exceeded0/3570ms10212 KiB
11Wrong answer0/337ms31856 KiB
12Wrong answer0/337ms32080 KiB
13Wrong answer0/337ms32180 KiB
14Wrong answer0/339ms32048 KiB
15Time limit exceeded0/3504ms31300 KiB
16Time limit exceeded0/3552ms31472 KiB
17Time limit exceeded0/3564ms31976 KiB
18Time limit exceeded0/3554ms32152 KiB
19Time limit exceeded0/3546ms32164 KiB
20Time limit exceeded0/3578ms32228 KiB
21Time limit exceeded0/3573ms32324 KiB
22Time limit exceeded0/6560ms32360 KiB
23Time limit exceeded0/6552ms32704 KiB
24Time limit exceeded0/6577ms32740 KiB