Submission #1932111


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        string S = cin.next();
        bool[] type = new bool[N];
        for (int i = 0; i < 2; i++)
        {
            for (int j = 0; j < 2; j++)
            {
                type[0] = i == 0;
                type[1] = j == 0;
                for (int k = 2; k < N; k++)
                {
                    type[k] = (type[k - 1]) ^ (S[k - 1] == 'o') ^ (type[k - 2]);
                }

                if (type[0] != (type[N - 1]) ^ (S[N - 1] == 'o') ^ (type[N - 2])) continue;
                if (type[1] != (type[0]) ^ (S[0] == 'o') ^ (type[N - 1])) continue;
                for (int k = 0; k < N; k++)
                {
                    if (type[k]) Console.Write("S");
                    else Console.Write("W");
                }
                Console.WriteLine();
                return;
            }
        }
        Console.WriteLine(-1);
    }

}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

Submission Info

Submission Time
Task D - Menagerie
User chokudai
Language C# (Mono 4.6.2.0)
Score 500
Code Size 2771 Byte
Status AC
Exec Time 222 ms
Memory 13120 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 16
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 9044 KB
00_example_02.txt AC 21 ms 9044 KB
00_example_03.txt AC 20 ms 9044 KB
01.txt AC 148 ms 9440 KB
02.txt AC 111 ms 9312 KB
03.txt AC 21 ms 13120 KB
04.txt AC 20 ms 9044 KB
05.txt AC 204 ms 11744 KB
06.txt AC 196 ms 9696 KB
07.txt AC 50 ms 9156 KB
08.txt AC 52 ms 9140 KB
09.txt AC 29 ms 9132 KB
10.txt AC 22 ms 11160 KB
11.txt AC 217 ms 11216 KB
12.txt AC 216 ms 11872 KB
13.txt AC 222 ms 9824 KB