Submission #1357610


Source Code Expand

using System;

namespace arc069_b
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            bool[] animals = new bool[n + 1];
            animals[0] = true; animals[1] = true;
            for (int i = 2; i <= n; i++)
            {
                if ((s[(i - 1) % n] == 'o') == (animals[i - 1] == true)) animals[i] = animals[i - 2];
                else animals[i] = !animals[i - 2];
            }
            if (animals[0] == animals[n])
            {
                for (int i = 0; i < n; i++)
                {
                    Console.Write(animals[i] ? 'S' : 'W');
                }
                Console.WriteLine();
            }
            else
            {
                animals[0] = true; animals[1] = false;
                for (int i = 2; i <= n; i++)
                {
                    if ((s[(i - 1) % n] == 'o') == (animals[i - 1] == true)) animals[i] = animals[i - 2];
                    else animals[i] = !animals[i - 2];
                }
                if (animals[0] == animals[n])
                {
                    for (int i = 0; i < n; i++)
                    {
                        Console.Write(animals[i] ? 'S' : 'W');
                    }
                    Console.WriteLine();
                }
                else
                {
                    animals[0] = false; animals[1] = true;
                    for (int i = 2; i <= n; i++)
                    {
                        if ((s[(i - 1) % n] == 'o') == (animals[i - 1] == true)) animals[i] = animals[i - 2];
                        else animals[i] = !animals[i - 2];
                    }
                    if (animals[0] == animals[n])
                    {
                        for (int i = 0; i < n; i++)
                        {
                            Console.Write(animals[i] ? 'S' : 'W');
                        }
                        Console.WriteLine();
                    }
                    else
                    {
                        animals[0] = false; animals[1] = false;
                        for (int i = 2; i <= n; i++)
                        {
                            if ((s[(i - 1) % n] == 'o') == (animals[i - 1] == true)) animals[i] = animals[i - 2];
                            else animals[i] = !animals[i - 2];
                        }
                        if (animals[0] == animals[n])
                        {
                            for (int i = 0; i < n; i++)
                            {
                                Console.Write(animals[i] ? 'S' : 'W');
                            }
                            Console.WriteLine();
                        }
                        else
                        {
                            Console.WriteLine(-1);
                        }
                    }
                }
            }
        }
    }
}

Submission Info

Submission Time
Task D - Menagerie
User mencotton
Language C# (Mono 4.6.2.0)
Score 0
Code Size 3064 Byte
Status WA
Exec Time 216 ms
Memory 13156 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 9
WA × 7
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 20 ms 11092 KB
00_example_02.txt AC 20 ms 11092 KB
00_example_03.txt AC 20 ms 9044 KB
01.txt WA 147 ms 11232 KB
02.txt AC 109 ms 13156 KB
03.txt AC 20 ms 11092 KB
04.txt AC 19 ms 9044 KB
05.txt WA 200 ms 11360 KB
06.txt AC 196 ms 11360 KB
07.txt WA 51 ms 11136 KB
08.txt AC 52 ms 9080 KB
09.txt AC 28 ms 11072 KB
10.txt WA 58 ms 9060 KB
11.txt WA 213 ms 9440 KB
12.txt WA 216 ms 9440 KB
13.txt WA 216 ms 11224 KB