QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#167046#5078. Castle Designideograph_advantageAC ✓9ms4536kbC++174.9kb2023-09-07 00:11:242023-09-07 00:11:24

Judging History

你现在查看的是最新测评结果

  • [2023-09-07 00:11:24]
  • 评测
  • 测评结果:AC
  • 用时:9ms
  • 内存:4536kb
  • [2023-09-07 00:11:24]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0);
#define iter(a) a.begin(), a.end()
#define pb(a) emplace_back(a)
#define mp(a, b) make_pair(a, b)
#define ff first
#define ss second
#define topos(a) ((a) = (((a) % MOD + MOD) % MOD))
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define SZ(a) int(a.size())
#ifdef LOCAL
void debug(){cerr << "\n";}
template<class T, class ... U> void debug(T a, U ... b){cerr << a << " ", debug(b...);}
template<class T> void pary(T l, T r) {
	while (l != r) cerr << *l << " ", l++;
	cerr << "\n";
}
#else
#define debug(...) void()
#define pary(...) void()
#endif

typedef long long ll;
typedef long double ld;

using pii = pair<int, int>;
using pll = pair<ll, ll>;

const ll MOD = 1000000007;
const ll MAX = 1e9;

template<typename A, typename B>
ostream& operator<<(ostream& o, pair<A, B> p){
    return o << '(' << p.ff << ',' << p.ss << ')';
}

ll ifloor(ll a, ll b){
    if(b < 0) a *= -1, b *= -1;
    if(a < 0) return (a - b + 1) / b;
    else return a / b;
}

ll iceil(ll a, ll b){
    if(b < 0) a *= -1, b *= -1;
    if(a > 0) return (a + b - 1) / b;
    else return a / b;
}

#define X ff
#define Y ss

int main(){
    StarBurstStream;

    string s;
    cin >> s;
    int n = SZ(s);

    vector<pii> dir = {pii(1, 0), pii(0, 1), pii(-1, 0), pii(0, -1)};
    int cur = 0;
    vector<int> hor(n / 2), ver(n / 2);
    for(int i = 0; i < n; i++){
        //debug("test", i, cur, dir[cur]);
        if(i % 2 == 0) hor[i / 2] = dir[cur].X;
        else ver[i / 2] = dir[cur].Y;
        if(s[i] == 'L') cur = (cur + 1) % 4;
        else cur = (cur - 1 + 4) % 4;
    }
    //pary(iter(hor));
    //pary(iter(ver));

    auto check = [&](vector<int> &v){
        int p01 = -1, p10 = -1;
        for(int i = 0; i < SZ(v); i++){
            if(v[i] == -1 && v[(i + 1) % SZ(v)] == 1){
                if(p01 != -1) return pii(-1, -1);
                p01 = i;
            }
            else if(v[i] == 1 && v[(i + 1) % SZ(v)] == -1){
                if(p10 != -1) return pii(-1, -1);
                p10 = i;
            }
        }
        return pii((p01 + 1) % SZ(v), (p10 + 1) % SZ(v));
    };
    auto [p01, p10] = check(hor);
    auto rot = [&](){
        //debug("rot");
        hor.swap(ver);
        for(int i = 0; i < n / 2; i++) hor[i] = -hor[i];
        rotate(ver.begin(), ver.begin() + 1, ver.end());
        tie(p01, p10) = check(hor);
        //pary(iter(hor));
        //pary(iter(ver));
    };
    auto fix = [&](){
        rotate(hor.begin(), hor.begin() + p01, hor.end());
        rotate(ver.begin(), ver.begin() + p01, ver.end());
        //debug("fix", p01, p10);
        //pary(iter(hor));
        //pary(iter(ver));
        p10 = (p10 - p01 + n / 2) % (n / 2);
        p01 = 0;
    };

    if(p01 == -1){
        //debug("rotate");
        rot();
    }
    fix();
    if(p10 < n / 2 - p10){
        rot();
        rot();
        fix();
    }

    //debug("p", p01, p10);

    vector<int> low, up;
    cur = 0;
    for(int i = 0; i < p10; i++){
        low.pb(cur);
        cur += ver[i];
    }
    cur = 0;
    for(int i = n / 2 - 1; i >= p10; i--){
        cur -= ver[i];
        up.pb(cur);
    }

    //pary(iter(low));
    //pary(iter(up));

    if(check(ver) != pii(-1, -1)){
        debug("2-mono");

        vector<int> tmp;
        bool ok = false;
        for(int i = 0; i < SZ(up); i++){
            tmp.pb(up[i]);
            if(!ok && ((i + 1 < SZ(up) && up[i] > up[i + 1]) || i + 1 == SZ(up))){
                int diff = SZ(low) - SZ(up);
                for(int j = 0; j < diff; j++) tmp.pb(up[i]);
                ok = true;
            }
        }
        int diff = -MAX;
        pary(iter(tmp));

        for(int i = 0; i < SZ(low); i++){
            diff = max(diff, low[i] - tmp[i] + 1);
            if(i + 1 < SZ(low)) diff = max(diff, max(low[i], low[i + 1]) - min(tmp[i], tmp[i + 1]) + 1);
        }

        debug("diff", diff);

        int ans = SZ(low) * 2 + n / 2 - 2;
        ans += up[0] - low[0] + diff;
        ans += up.back() - low.back() + diff;
        
        cout << ans << "\n";
        
        return 0;
    }

    vector<int> dp(SZ(up), MAX);
    dp[0] = 0;
    for(int i = 1; i < SZ(low); i++){
        for(int j = SZ(up) - 1; j >= 0; j--){
            int t1 = MAX;
            if(j) t1 = max({dp[j - 1], low[i] - up[j] + 1, max(low[i], low[i - 1]) - min(up[j], up[j - 1]) + 1});
            int t2 = max(dp[j], low[i] - up[j] + 1);
            dp[j] = min(t1, t2);
        }
        //debug("dp", i);
        //pary(iter(dp));
    }
    int diff = dp[SZ(up) - 1];
    int ans = SZ(low) * 2 + n / 2 - 2;
    ans += up[0] - low[0] + diff;
    ans += up.back() - low.back() + diff;
    pary(iter(up));
    pary(iter(low));
    debug("test", diff);
    cout << ans << "\n";
    
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3612kb

input:

LLRLLRLLRLRLLR

output:

16

result:

ok single line: '16'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3620kb

input:

RLLRLLLRRLLRLRLL

output:

20

result:

ok single line: '20'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

LLRRLLLLRRLL

output:

16

result:

ok single line: '16'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3560kb

input:

RLLRLLRLLRLL

output:

12

result:

ok single line: '12'

Test #5:

score: 0
Accepted
time: 2ms
memory: 4392kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

199996

result:

ok single line: '199996'

Test #6:

score: 0
Accepted
time: 2ms
memory: 4536kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

155164

result:

ok single line: '155164'

Test #7:

score: 0
Accepted
time: 2ms
memory: 4400kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

189748

result:

ok single line: '189748'

Test #8:

score: 0
Accepted
time: 2ms
memory: 4164kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

137900

result:

ok single line: '137900'

Test #9:

score: 0
Accepted
time: 2ms
memory: 4328kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

100002

result:

ok single line: '100002'

Test #10:

score: 0
Accepted
time: 3ms
memory: 4528kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

134442

result:

ok single line: '134442'

Test #11:

score: 0
Accepted
time: 2ms
memory: 4224kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

112388

result:

ok single line: '112388'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

10004

result:

ok single line: '10004'

Test #13:

score: 0
Accepted
time: 1ms
memory: 3736kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

17478

result:

ok single line: '17478'

Test #14:

score: 0
Accepted
time: 1ms
memory: 3680kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

10006

result:

ok single line: '10006'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3688kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

40004

result:

ok single line: '40004'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

30730

result:

ok single line: '30730'

Test #17:

score: 0
Accepted
time: 1ms
memory: 3972kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

20004

result:

ok single line: '20004'

Test #18:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

27698

result:

ok single line: '27698'

Test #19:

score: 0
Accepted
time: 1ms
memory: 3748kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

33668

result:

ok single line: '33668'

Test #20:

score: 0
Accepted
time: 1ms
memory: 3688kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

20010

result:

ok single line: '20010'

Test #21:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

3874

result:

ok single line: '3874'

Test #22:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

2704

result:

ok single line: '2704'

Test #23:

score: 0
Accepted
time: 1ms
memory: 3588kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

2848

result:

ok single line: '2848'

Test #24:

score: 0
Accepted
time: 0ms
memory: 3948kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

33368

result:

ok single line: '33368'

Test #25:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

36144

result:

ok single line: '36144'

Test #26:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

3116

result:

ok single line: '3116'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

4804

result:

ok single line: '4804'

Test #28:

score: 0
Accepted
time: 1ms
memory: 3652kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

2404

result:

ok single line: '2404'

Test #29:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

33388

result:

ok single line: '33388'

Test #30:

score: 0
Accepted
time: 1ms
memory: 3600kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLL

output:

288

result:

ok single line: '288'

Test #31:

score: 0
Accepted
time: 1ms
memory: 3812kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

4068

result:

ok single line: '4068'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3744kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

40004

result:

ok single line: '40004'

Test #33:

score: 0
Accepted
time: 0ms
memory: 3740kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

60744

result:

ok single line: '60744'

Test #34:

score: 0
Accepted
time: 1ms
memory: 3780kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

40410

result:

ok single line: '40410'

Test #35:

score: 0
Accepted
time: 1ms
memory: 3852kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

88004

result:

ok single line: '88004'

Test #36:

score: 0
Accepted
time: 0ms
memory: 3900kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

79904

result:

ok single line: '79904'

Test #37:

score: 0
Accepted
time: 2ms
memory: 4100kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

114084

result:

ok single line: '114084'

Test #38:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

66646

result:

ok single line: '66646'

Test #39:

score: 0
Accepted
time: 0ms
memory: 4104kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

93288

result:

ok single line: '93288'

Test #40:

score: 0
Accepted
time: 0ms
memory: 3952kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

128004

result:

ok single line: '128004'

Test #41:

score: 0
Accepted
time: 2ms
memory: 4120kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

89292

result:

ok single line: '89292'

Test #42:

score: 0
Accepted
time: 2ms
memory: 4016kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

66674

result:

ok single line: '66674'

Test #43:

score: 0
Accepted
time: 2ms
memory: 4040kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

80004

result:

ok single line: '80004'

Test #44:

score: 0
Accepted
time: 1ms
memory: 4344kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

120294

result:

ok single line: '120294'

Test #45:

score: 0
Accepted
time: 2ms
memory: 4160kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

135798

result:

ok single line: '135798'

Test #46:

score: 0
Accepted
time: 1ms
memory: 3684kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

11576

result:

ok single line: '11576'

Test #47:

score: 0
Accepted
time: 1ms
memory: 3856kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

806

result:

ok single line: '806'

Test #48:

score: 0
Accepted
time: 2ms
memory: 4320kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

122092

result:

ok single line: '122092'

Test #49:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

LRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

17604

result:

ok single line: '17604'

Test #50:

score: 0
Accepted
time: 2ms
memory: 4244kb

input:

LLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

99996

result:

ok single line: '99996'

Test #51:

score: 0
Accepted
time: 1ms
memory: 3616kb

input:

LLLL

output:

4

result:

ok single line: '4'

Test #52:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

LLRLRLLRLRRLRLRLRLRLRLRLRLRLLRRLLRRLRLRLRLLRLRLRRLLRLRLRLRRLLRRLRLLRLRRLLRLRRLRLRLLRLRRLLRLRRLLRRLRLLRRLRLLRLRRLLRRLRLRLLRLRRLLRRLRLLRRLRLRLLRLRRLLRRLRLRLLRLRRLRLRLLRLRLRLRRLRLLRRLRLRLRLRLRLRLLRLRLRLRLRRLRLLRRLLRRLRLRLLRLRLRRLRLLRRLLRRLLRLRLRRLLRLRRLRLLRLRLRRLRLRLRLRLLRLRLRRLRLLRRLRLRLLRLRRLRLRLRLLR...

output:

1044

result:

ok single line: '1044'

Test #53:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

LLLRRLLRLRRLRLLRRLLRLRLRRLLRRLRLRLRLRLRLRLLRLRLRLRRLLRLRRLRLRLLRRLLRLRRLRLRLLRRLLRLRRLLRLLLRLRRLLRRLLRRLLRLRRLRLLRRLLRLRLRLRRLRLRLLRRLLRLRLRRLRLRLLRRLRLLRLRRLLRRLRLRLLRLRLRLRLRLRRLRLRLRLRLRLRLLRLRRLLRRLLRRLRLLRLRLRRLLRRLRLLRLRRLRLLRRLLRRLLRLRLRLRRLRLRLRLRLRLLRRLLRRLRLLRRLLRLRRLLRRLLRRLLRRLLRRLLRLRLR...

output:

1442

result:

ok single line: '1442'

Test #54:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

LLLRLRLRRLLRLRLRRLLRLRLRLRRLRLLRLRRLRLLRLRLRRLRLRLLRRLRLLRRLRLLRLRRLLRLRRLLRLRLRLRLRRLLRRLLRRLRLRLLRLRRLRLLRRLLRRLRLRLRLRLRLRLLRRLLRLRRLLRLRRLLRLRRLRLLRRLRLRLRLLRLRLRLRLRLRLRLRLRRLLRRLLRLRRLRLLRLRLRLRLRLRRLRLLRRLLRLRLRRLLRRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRRLRLRLLRRLRLLRLRRLRLLRLRLRRLLRRLRLLRRLLRLRLRLRRL...

output:

1578

result:

ok single line: '1578'

Test #55:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

LLRLLRLRLRLRRLRLRLLRRLRLLRLRRLLRRLRLLRLRRLLRRLLRRLRLLRLRLRLRLRLRRLLRRLLRRLLRLRRLRLLRLRRLLRRLRLLRRLRLLRRLRLLRLRLRRLRLRLRLLRRLRLLRRLLRLRRLRLRLRLLRLRRLRLLRLRRLRLLRRLRLRLLRLRLRRLLRLRLRRLRLLRRLLRLRRLLRRLRLLRLRRLRLLRRLRLLRRLLRLRLRLRRLRLLRRLRLLRRLLRLRLRRLRLRLLRRLRLLRLRLRRLRLLRRLRLLRLRRLLRLRRLLRLRRLLRLRLRLR...

output:

2910

result:

ok single line: '2910'

Test #56:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

LLRLRLRLLRRLLRLRLRRLRLRLLRRLLRLRLRLRLRRLLRRLRLRLLRRLRLRLRLLRRLRLRLRLLRLRRLRLLRLRRLLRRLLRRLRLLRRLRLRLRLRLLRLRRLRLLRLRLRRLRLRLRLRLRLLRRLLRLRRLLRLRRLLRLRLRRLRLLRRLLRRLRLLRRLRLLRRLRLRLLRRLLRLRLRLRRLLRRLRLRLRLRLLRLRRLLRRLRLRLRLLRRLLRRLRLRLRLLRLRRLRLLRRLLRRLRLLRLRRLLRLRRLLRRLLRRLRLLRLRLRLRRLLRRLLRLRLRLRLR...

output:

2040

result:

ok single line: '2040'

Test #57:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

LLLRRLLRLRLRRLLRLRRLLRLRLRRLLRLRLRRLRLLRLRRLLRRLRLLRLRLRLRLRLRLRLRLRLRRLLRRLRLRLRLLRLRLRRLLRRLLRLRRLRLRLLRRLRLLRLRLRRLLRLRRLLRLRRLLRRLRLRLLRLRLLRLLRLRRLRLLRRLRLRLLRRLLRLRRLLRRLRLRLLRRLLRRLRLRLRLRLRLRLLRRL

output:

270

result:

ok single line: '270'

Test #58:

score: 0
Accepted
time: 1ms
memory: 3504kb

input:

LLLRRLLRLRLRRLRLLRLRRLLRRLLRLRLRRLLRLRLRRLLRRLRLRLRLLRRLLRRLRLLRLRRLRLRLRLRLRLLRRLRLRLRLRLLRRLLRRLRLLRLRRLLRLRLRRLLRLRLLLRRLRLRLLRRLRLRLRLRLRLLRRLRLRLLRLRRLRLRLLRRLLRRLRLLRRLRLRLRLLRRLRLLRLRLRLRRLLRLRRLLR

output:

228

result:

ok single line: '228'

Test #59:

score: 0
Accepted
time: 1ms
memory: 3848kb

input:

LLLRRLLRLRLRLRLLRLLRRLRL

output:

32

result:

ok single line: '32'

Test #60:

score: 0
Accepted
time: 2ms
memory: 3684kb

input:

LLLRLRRLRLRLLRLRLRLRRLLRRLRLRLRLRLLRLRLRRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRRLLRRLLRLRLRLRRLRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRRLRLRLLRLRLRRLLRLRLRLRRLRLRLLRLRRLRLLRLRRLLRLRLRRLRLLRRLRLRLRLLRLRRLRLLRLRRLRLLRRLLRLRRLRLRLRLRLRLLRRLRLRLRLRLLRRLRLLRRLRLLRLRRLRLLRRLLRLRLRRLLRLRRLLRRLRLRLRLRLRLRLLRLRLRLRRLLRLRLRRLRL...

output:

3486

result:

ok single line: '3486'

Test #61:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

LLLRRLRLLRRLRLLRLRLRLRLRLRLRRLRLRLLRRLLRLRLRRLRLLRRLLRLRLRLRLRLRLRLRLRRLLRRLLRLRRLRLRLRLLRRLRLRLRLRLLRLRLRRLRLLRRLLRLRRLLRLRLRRLLRLRRLRLLRLRLRLRLRRLRLRLRLLRLRLRRLRLRLRLRLLRRLRLRLRLRLLRRLRLLRLRLRRLRLRLLRRLRLRLLRRLLRLRLRRLLRLRRLRLLRLRRLLRRLRLRLLRRLRLLRRLRLRLRLLRLRLRRLRLLRLRLRLRRLLRRLLRRLLRLRLRRLLRRLLR...

output:

4834

result:

ok single line: '4834'

Test #62:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

LLRLLRRLRLLRRLLRLRRLRLRLRLLRRLRLRLRLLRRLLRRLRLRLRLRLRLLRRLRLLRLRLRLRLRRLRLRLRLLRLRRLLRLRLRLRLRRLLRRLRLLRLRLRRLLRLRRLRLLRLRLRRLRLRLRLLRLRRLRLLRRLRLRLLRRLRLLRRLRLRLLRLRRLLRLRLRLRRLLRRLLRRLRLRLRLRLLRRLRLRLLRRLRLLRRLRLRLLRLRLRLRLRRLLRLRRLRLRLRLLRRLRLLRLRRLRLLRRLRLLRRLRLLRLRRLRLRLRLRLLRLRLRRLRLLRRLRLLRLR...

output:

5156

result:

ok single line: '5156'

Test #63:

score: 0
Accepted
time: 3ms
memory: 3672kb

input:

LLRLLRLRLRLRLRLRLRRLLRLRRLLRLRLRRLLRLRLRLRLRLRLRRLLRRLLRLRRLLRLRLRRLRLLRRLRLRLLRLRLRRLRLRLLRRLRLRLRLRLLRRLLRRLLRRLLRRLLRLRRLLRRLLRRLLRRLRLLRLRLRLRRLLRLRLRLRLRLRRLRLLRLRRLRLLRRLLRLRLRLRRLLRLRLRRLRLLRLRRLLRLRLRRLRLRLRLRLLRRLRLRLLRRLRLLRLRLRRLLRLRLRLRLRLRLRLRLRRLLRRLRLRLLRLRLRRLLRLRRLLRLRLRLRLRRLRLLRRL...

output:

5564

result:

ok single line: '5564'

Test #64:

score: 0
Accepted
time: 3ms
memory: 3716kb

input:

LLLRRLRLRLLRLRRLLRRLLRRLLRRLLRLRRLRLLRRLRLRLRLLRLRRLRLLRRLRLRLRLLRLRLRLRRLRLRLLRLRLRRLLRLRRLLRLRRLLRRLLRLRLRLRLRLRRLLRRLLRRLLRLRLRRLLRRLRLLRRLLRRLLRRLLRLRRLLRLRRLLRRLRLLRRLLRLRRLLRLRRLLRLRRLRLLRLRRLRLRLLRLRLRRLRLLRLRLRRLLRLRRLRLRLRLLRRLRLLRLRRLLRLRLRLRLRRLLRRLRLRLRLLRLRRLRLRLRLLRRLRLRLRLRLLRLRLRRLLR...

output:

7944

result:

ok single line: '7944'

Test #65:

score: 0
Accepted
time: 3ms
memory: 3856kb

input:

LLLRRLRLRLLRLRLRRLLRRLLRLRRLLRLRRLLRLRLRRLRLLRRLLRRLLRLRLRRLLRLRLRRLRLLRLRLRRLLRLRLRLRLRRLLRLRLRRLLRLRLRLRRLLRLRLRRLRLLRRLRLLRRLLRLRLRRLRLRLRLLRLRLRRLRLRLLRLRLRLRLRLRRLRLRLLRRLRLLRLRRLLRRLRLRLRLRLLRLRRLLRRLRLRLRLLRLRRLLRRLRLRLRLRLLRLRRLLRRLRLLRLRLRLRLRLRRLRLLRLRLRLRLRRLLRRLLRLRRLLRLRLRLRLRRLLRLRLRRL...

output:

7544

result:

ok single line: '7544'

Test #66:

score: 0
Accepted
time: 5ms
memory: 3852kb

input:

LLLRRLLRLRRLLRRLLRLRLRLRLRLRRLRLRLLRLRRLLRLRLRLRRLLRRLRLLRLRLRRLLRRLLRLRLRRLLRRLRLLRLRLRRLRLRLRLLRRLRLLRRLLRRLLRLRLRLRLRLRLRLRRLLRLRLRLRLRRLRLLRLRRLLRRLRLLRLRLRRLLRLRLRLRLRLRLRLRRLLRLRRLLRRLRLRLRLLRLRLRLRRLRLRLLRRLLRLRLRLRLRLRLRLRLRRLLRRLRLRLLRLRRLRLRLLRRLRLRLLRLRLRLRLRRLLRLRLRLRLRRLRLRLLRLRLRRLLRLR...

output:

7942

result:

ok single line: '7942'

Test #67:

score: 0
Accepted
time: 2ms
memory: 3632kb

input:

LLLRLRRLRLRLRLRLLRRLLRRLRLRLLRLRRLLRRLLRRLRLRLRLLRRLRLRLLRRLLRRLLRRLLRLRRLRLLRRLRLRLRLLRLRLRLRRLRLRLLRRLLRLRLRLRRLLRRLLRRLLRLRRLLRRLLRLRLRRLRLLRLRLRRLLRLRLRLRLRLRLRRLRLRLRLLRRLRLRLRLLRLRLRLRLRLRRLRLRLLRLRLRLRLRLRLRRLLRRLLRRLRLLRRLRLLRRLLRLRRLLRLRRLRLRLRLRLLRRLLRLRLRLRLRLRLRRLLRRLRLLRRLRLRLRLLRLRRLRL...

output:

10056

result:

ok single line: '10056'

Test #68:

score: 0
Accepted
time: 6ms
memory: 3860kb

input:

LLLRRLRLLRRLLRLRLRLRLRRLRLRLRLRLRLRLRLLRLRRLRLRLRLRLRLRLLRRLLRRLLRRLRLLRLRRLRLRLLRRLRLRLRLRLRLLRRLLRLRRLRLLRRLLRRLLRLRLRRLLRLRRLLRRLLRLRLRLRRLRLLRRLRLRLRLLRRLRLLRLRRLLRRLLRLRLRLRLRRLLRLRRLRLRLRLRLLRRLLRLRLRRLRLRLLRLRLRLRRLRLRLLRLRRLLRRLRLRLRLLRLRLRLRRLLRRLLRLRRLLRLRRLRLLRLRRLLRRLRLLRLRLRRLRLRLRLRLLR...

output:

8154

result:

ok single line: '8154'

Test #69:

score: 0
Accepted
time: 5ms
memory: 3656kb

input:

LLLRRLLRLRLRRLLRRLLRRLRLLRLRRLLRLRLRLRRLRLRLLRLRLRRLLRRLLRRLLRRLLRRLLRLRLRRLRLRLLRRLRLLRRLRLLRLRLRRLRLRLRLRLLRLRRLRLRLRLRLRLLRLRRLRLLRLRLRRLLRLRRLLRRLLRLRLRRLLRRLLRRLLRLRRLLRLRRLLRLRRLRLRLRLLRRLRLLRRLRLRLRLRLLRRLRLLRLRLRLRRLLRLRLRRLLRRLRLRLLRLRRLLRLRRLRLRLRLLRLRRLLRLRRLLRLRLRLRLRRLLRRLLRLRRLRLRLLRLR...

output:

10130

result:

ok single line: '10130'

Test #70:

score: 0
Accepted
time: 6ms
memory: 3708kb

input:

LLLRLRRLLRRLRLLRLRLRRLLRLRRLLRLRRLLRLRLRLRRLRLRLRLLRLRLRLRLRRLRLLRLRRLRLLRLRLRLRLRRLRLRLLRLRRLRLLRLRRLRLLRRLLRLRRLRLRLLRLRLRLRRLRLLRLRLRLRLRLRRLRLLRRLLRRLRLLRRLLRLRLRRLLRRLRLRLRLLRRLRLRLLRLRLRRLRLLRLRRLLRRLRLLRLRLRRLLRRLLRRLRLLRRLLRRLRLLRLRLRLRLRRLRLRLLRRLLRLRRLRLLRRLRLLRRLLRRLRLRLLRRLLRLRRLLRLRRLLR...

output:

11160

result:

ok single line: '11160'

Test #71:

score: 0
Accepted
time: 5ms
memory: 3964kb

input:

LLLRRLRLRLLRRLLRRLRLLRLRLRLRLRLRLRLRLRLRLRRLRLLRRLRLRLLRRLRLRLLRRLLRLRLRLRRLLRRLRLLRLRLRRLRLRLLRLRRLRLRLRLLRRLLRRLLRRLLRLRLRRLLRRLRLLRLRRLLRRLLRRLRLRLRLRLLRRLLRLRLRRLRLRLLRRLRLRLRLLRRLRLRLLRLRRLLRRLLRRLLRRLRLRLLRLRRLRLLRLRLRLRRLRLRLLRRLLRRLLRRLLRLRRLLRLRRLRLRLRLRLRLLRLRLRRLLRRLLRLRRLRLLRLRRLRLRLRLLR...

output:

13682

result:

ok single line: '13682'

Test #72:

score: 0
Accepted
time: 5ms
memory: 3672kb

input:

LLLRRLLRRLLRRLLRRLRLRLLRRLRLRLRLLRLRRLLRRLRLLRRLRLRLLRLRRLRLRLRLRLRLLRLRLRLRRLRLRLRLRLRLLRRLLRRLRLRLRLRLLRLRRLRLLRRLRLLRRLRLRLRLRLRLLRLRRLRLLRRLRLRLRLRLRLRLLRLRRLLRLRRLLRLRRLRLRLLRLRRLLRRLRLLRLRLRLRLRLRRLRLRLRLRLRLRLRLLRLRRLLRRLRLLRRLLRLRRLRLLRRLRLLRRLLRLRLRLRRLRLLRLRLRRLRLLRLRRLLRLRLRLRLRRLRLRLRLLR...

output:

13578

result:

ok single line: '13578'

Test #73:

score: 0
Accepted
time: 9ms
memory: 3880kb

input:

LLRLLRRLRLRLRLLRLRLRRLLRLRLRRLRLLRRLRLRLRLLRLRLRLRRLRLRLRLLRRLLRRLLRRLLRLRLRRLRLRLRLRLLRRLLRLRLRLRLRRLLRRLRLRLRLLRLRRLLRRLLRRLLRRLLRRLRLLRRLLRRLRLLRRLRLLRRLRLLRLRRLLRRLLRRLRLLRLRRLRLLRLRRLLRLRLRRLLRLRLRLRLRLRRLLRLRLRLRLRLRRLLRLRLRLRLRRLLRRLRLLRLRRLRLLRLRLRRLLRLRRLRLLRRLLRLRLRLRLRRLRLLRLRRLRLLRRLLRRL...

output:

11296

result:

ok single line: '11296'

Test #74:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLR

output:

102

result:

ok single line: '102'

Test #75:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

1006

result:

ok single line: '1006'

Test #76:

score: 0
Accepted
time: 1ms
memory: 3592kb

input:

LLLRLRLRRLRLRLLLRLRLRLLRLRLR

output:

30

result:

ok single line: '30'

Test #77:

score: 0
Accepted
time: 9ms
memory: 3672kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

9998

result:

ok single line: '9998'

Test #78:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR

output:

168

result:

ok single line: '168'

Test #79:

score: 0
Accepted
time: 2ms
memory: 3572kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

4008

result:

ok single line: '4008'

Test #80:

score: 0
Accepted
time: 6ms
memory: 3888kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

8008

result:

ok single line: '8008'

Test #81:

score: 0
Accepted
time: 1ms
memory: 3580kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

1604

result:

ok single line: '1604'

Test #82:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

1606

result:

ok single line: '1606'

Test #83:

score: 0
Accepted
time: 9ms
memory: 3720kb

input:

LLLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLR...

output:

9606

result:

ok single line: '9606'