I had a basically identical solution to you for the first two test cases. I 
made one change to my solution in an attempt to make it more efficient for the 
hidden test case. I switched from concatenating strings to using a 
StringBuilder (I was concerned about memory too).


Can't spot anything else with your code that might cause a timeout. Try change 
the strings to use StringBuilder and let me know if that makes the difference!


My attempt:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codejam2019
{
    class Program
    {
        static void Main(string[] args)
        {
            int t;

            int.TryParse(Console.ReadLine(), out t);
            for (int i = 1; i <= t; ++i)
            {
                int n;
                int.TryParse(Console.ReadLine(), out n);

                string usedMoves = Console.ReadLine();

                StringBuilder newMoves = new StringBuilder("", 
usedMoves.Length);

                for(int j = 0; j < usedMoves.Length; j++)
                {
                    if (usedMoves[j] == 'S')
                    {
                        newMoves.Append('E');
                    } else
                    {
                        newMoves.Append('S');
                    }
                }

                Console.WriteLine("Case #" + i + ": " + newMoves);
            }
        }
    }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/f8c8bfe9-7b91-45f8-bffc-f647fca1060e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to