Submission #1909507


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

using int64 = long long;

int main()
{
  int N;
  string S;

  cin >> N;
  cin >> S;

  for(int i = 0; i < 2; i++) {


    for(int j = 0; j < 2; j++) {

      vector< int > x(N + 2);
      x[0] = i;
      x[1] = j;

      for(int k = 1; k <= N; k++) {
        x[k + 1] = x[k] ^ (S[k % N] == 'x') ^ x[k - 1];
      }
      if(x[0] == x[N] && x[1] == x[N + 1]) {
        for(int k = 0; k < N; k++) {
          if(x[k]) cout << "W";
          else cout << "S";
        }
        cout << endl;
        return (0);
      }
    }
  }

  cout << -1 << endl;
}

Submission Info

Submission Time
Task D - Menagerie
User ei13333
Language C++14 (GCC 5.4.1)
Score 500
Code Size 638 Byte
Status
Exec Time 10 ms
Memory 1016 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 500 / 500 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 1 ms 256 KB
00_example_02.txt 1 ms 256 KB
00_example_03.txt 1 ms 256 KB
01.txt 7 ms 644 KB
02.txt 5 ms 640 KB
03.txt 1 ms 256 KB
04.txt 1 ms 256 KB
05.txt 9 ms 924 KB
06.txt 8 ms 896 KB
07.txt 3 ms 384 KB
08.txt 3 ms 384 KB
09.txt 2 ms 256 KB
10.txt 2 ms 384 KB
11.txt 10 ms 1016 KB
12.txt 10 ms 1016 KB
13.txt 10 ms 1016 KB