Submission #2211353


Source Code Expand

#include <iostream>
#include <string>
using namespace std;

typedef long long lint;

int main(){
    int N;
    string s;
    cin >> N >> s;
    string init[4]={"SS","SW","WS","WW"};

    for(int i=0;i<4;i++){
        string res=init[i];
        for(int j=1;j<s.size()-1;j++){
            if((s[j]=='o' && res[j]=='S')||(s[j]=='x' && res[j]=='W')) res=res+res[j-1];
            else res=res+(res[j-1]=='S'?'W':'S');
        }
        string test="";
        int l=s.size()-1;
        if((s[l]=='o' && res[l]=='S')||(s[l]=='x' && res[l]=='W')) test=test+res[l-1];
        else test=test+(res[l-1]=='S'?'W':'S');
        if((s[0]=='o' && res[0]=='S')||(s[0]=='x' && res[0]=='W')) test=test+res[l];
        else test=test+(res[l]=='S'?'W':'S');

        if(test==init[i]){
            cout << res << endl;
            return 0;
        }
    }
    cout << (-1) << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Menagerie
User wisteria0410ss
Language C++14 (GCC 5.4.1)
Score 0
Code Size 914 Byte
Status TLE
Exec Time 2060 ms
Memory 920 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 14
TLE × 2
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 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 1 ms 256 KB
01.txt AC 610 ms 808 KB
02.txt AC 105 ms 624 KB
03.txt AC 4 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 1269 ms 904 KB
06.txt AC 462 ms 816 KB
07.txt AC 31 ms 384 KB
08.txt AC 25 ms 384 KB
09.txt AC 2 ms 256 KB
10.txt AC 65 ms 384 KB
11.txt TLE 2049 ms 920 KB
12.txt TLE 2060 ms 920 KB
13.txt AC 1551 ms 920 KB