QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#376836#4567. Admissible MapInfinityNSTL 1729ms200900kbC++173.2kb2024-04-04 17:18:102024-04-04 17:18:10

Judging History

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

  • [2024-04-04 17:18:10]
  • 评测
  • 测评结果:TL
  • 用时:1729ms
  • 内存:200900kb
  • [2024-04-04 17:18:10]
  • 提交

answer

#include<bits/stdc++.h>
#define sz(x) (int)(x).size()
#define f first
#define s second
#define pb push_back
#define ll long long
#define all(x) (x).begin(),(x).end()
using namespace std;
// 19:33
const int N=20002;
int visited[N];
bool inc[N];
int nxt[N];
int need[N];
bool moze[N][N];
bool pocetak[N],kraj[N];
int nxtNo[N];
int up[N],down[N];
int dfs(int tr){
    if(nxt[tr]==-1){
        inc[tr]=0;
        visited[tr]=1;
        return -1;
    }
    if(visited[nxt[tr]]==1){
        inc[tr]=0;
        visited[tr]=1;
        return -1;
    }
    if(visited[nxt[tr]]==2){
        inc[tr]=1;
        visited[tr]=1;
        return nxt[tr];
    }
    visited[tr]=2;
    int r=dfs(nxt[tr]);
    visited[tr]=1;
    if(r==-1){
        inc[tr]=0;
        return -1;
    }
    else{
        inc[tr]=1;
        if(tr==r)return -1;
        return r;
    }
}
int main(){
    string s(20000,'R');
    cin >> s;
    int n=sz(s);
    //for(int i=0;i<n;i++)if(i&1)s[i]='L';else s[i]='R';
    for(int i=0;i<n;i++){
        up[i+1]=s[i]=='U';
        up[i+1]+=up[i];
        down[i+1]=s[i]=='D';
        down[i+1]+=down[i];
    }
    for(int len=1;len<=n;len++){
        for(int i=0;i<n;i++){
            inc[i]=0;
            visited[i]=0;
            if(s[i]=='L'){
                nxt[i]=i-1;
            }
            if(s[i]=='R'){
                nxt[i]=i==n-1?-1:i+1;
            }
            if(s[i]=='U'){
                nxt[i]=i<len?-1:i-len;
            }
            if(s[i]=='D'){
                nxt[i]=i>=n-len?-1:i+len;
            }
            need[i]=0;
        }
        for(int i=0;i<n;i++){
            pocetak[i]=kraj[i]=0;
            if(!visited[i]){
                dfs(i);
            }
            if(nxt[i]==-1||!inc[i]){
                need[i]=n;
            }
            if(need[i]==n)continue;
            if(nxt[i]>i){
                if(need[i]<nxt[i])need[i]=nxt[i];
            }
            else{
                if(need[nxt[i]]<i)need[nxt[i]]=i;
            }
        }
        int no=n;
        for(int i=n-1;i>=0;i--){
            if(need[i]==n)no=i;
            nxtNo[i]=no;
        }
        int r=0;
        int lst=0;
        for(int i=0;i<n;i++){
            if(need[i]==n){
                lst=i+1;
                r=i+1;
                continue;
            }
            if(r<need[i])r=need[i];
            if(r==i){
                pocetak[lst]=1;
                kraj[r+1]=1;
                lst=i+1;
                r=i+1;
            }
        }
        for(int i=0;i<=n-len;i++){
            if(pocetak[i]){
                int tr=i;
                bool ok=!(up[tr+len]-up[tr])&&s[tr]!='L'&&s[tr+len-1]!='R';
                tr+=len;
                while(ok&&tr<=nxtNo[i]){
                    if(kraj[tr]&&!(down[tr]-down[tr-len])){
                        moze[i][tr-1]=1;
                    }
                    if(tr>n-len)break;
                    ok=ok&&s[tr]!='L'&&s[tr+len-1]!='R';
                    tr+=len;
                }
            }
        }
    }
    int ans=0;
    for(int i=0;i<n;i++)for(int j=i;j<n;j++)ans+=moze[i][j];
    printf("%i\n",ans);
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5884kb

input:

RDUL

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

RDRU

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

RLRLRL

output:

6

result:

ok 1 number(s): "6"

Test #4:

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

input:

D

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

DL

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

RL

output:

1

result:

ok 1 number(s): "1"

Test #7:

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

input:

DU

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

RDULU

output:

2

result:

ok 1 number(s): "2"

Test #9:

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

input:

RDDUULRDDD

output:

2

result:

ok 1 number(s): "2"

Test #10:

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

input:

RLRLRLRLRL

output:

15

result:

ok 1 number(s): "15"

Test #11:

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

input:

DUDUDUDUDU

output:

15

result:

ok 1 number(s): "15"

Test #12:

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

input:

RDRDULULRR

output:

3

result:

ok 1 number(s): "3"

Test #13:

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

input:

UUURDRDRDLRULLRLULUDRURDRULLRU

output:

2

result:

ok 1 number(s): "2"

Test #14:

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

input:

RLRLRLRLRLRLRLRLRLRLRLRLRLRLRL

output:

120

result:

ok 1 number(s): "120"

Test #15:

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

input:

DUDUDUDUDUDUDUDUDUDUDUDUDUDUDU

output:

120

result:

ok 1 number(s): "120"

Test #16:

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

input:

RDRDRDRDRDRDRDULULULULULULULDL

output:

8

result:

ok 1 number(s): "8"

Test #17:

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

input:

DLURRURRLDDUUDRDURDDLRLULLULDUULDDRDUURLLDDLRRLUDURLLRRRLLRLUDULDULUUDLLDLRLULDDURDDDLLUURRDRRDDRULU

output:

18

result:

ok 1 number(s): "18"

Test #18:

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

input:

RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL

output:

1275

result:

ok 1 number(s): "1275"

Test #19:

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

input:

DUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDU

output:

1275

result:

ok 1 number(s): "1275"

Test #20:

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

input:

RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDULULULULULULULULULULULULULULULULULULULULULULULULUL

output:

26

result:

ok 1 number(s): "26"

Test #21:

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

input:

LRULLRUURRDUULDRULLLRLUDLDRUUURRDDRDLLDDRLUDLRLRRLRRUDUUULDDLUDUDRURUDLLRLDRLLDULRRURLDLDDDLUUUDRRUDRDURRRDLLDRDRRDULULRLLULULDLDLUURRRLRRUUUUDUUUULLURLUUDLURDUDDUDDURDDURRRLURDLUDDDDLRLDULRRRULLDDDDLLLDDLUDURDURLDDUDDRDLLULRRUDRRDRRRLUUULRLDDDDDDURRDULUDDDLDLLUDDUUDDDLLRDDRLRRLRDLDUDUDRULURRRULRLRD

output:

43

result:

ok 1 number(s): "43"

Test #22:

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

input:

RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL

output:

11325

result:

ok 1 number(s): "11325"

Test #23:

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

input:

DUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDU

output:

11325

result:

ok 1 number(s): "11325"

Test #24:

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

input:

RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULULUL

output:

76

result:

ok 1 number(s): "76"

Test #25:

score: 0
Accepted
time: 14ms
memory: 24352kb

input:

LRRDDUUDLRLDLLRRDRLRDRLUDURURLLDURDLUDDRDLRLUULRLLDLRRRLDRRULRRULURRUDURRDLULLLDDRURLLURURLRRRRLURLURUUDRURDLLRUDDLULDLLRULRURDLRDUULURDULLLRLRDLRRUDUUUDUDLLRULRRRDRLLRRURRRRRLRDULDURRDLDULLURLLLURLRLDDRURULLDULULDRLDRLUUDDULLDRRDRURURDUUDDRDULRRUUDULULDDLRDURUUUURULLURRUDRURLUDLLUURRULRURDDRDRLUDUU...

output:

168

result:

ok 1 number(s): "168"

Test #26:

score: 0
Accepted
time: 10ms
memory: 24368kb

input:

RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

125250

result:

ok 1 number(s): "125250"

Test #27:

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

input:

DUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDU...

output:

125250

result:

ok 1 number(s): "125250"

Test #28:

score: 0
Accepted
time: 4ms
memory: 14140kb

input:

RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRD...

output:

251

result:

ok 1 number(s): "251"

Test #29:

score: 0
Accepted
time: 141ms
memory: 63260kb

input:

RDLRLLLLDDLDUUURUDUDUDUURURLRURLURLRLUULLRUDUURLDDRRDRUULDUURUDUUDLRLDUUUDRLLDRRDLLULDULRDURLLRLUDDRRLUDURRUUDULDLDLLDDUDURDLULRLLDRDRURUDLRDUDULLDUDDLRRRUDLLLRDLLRDDLDRDLRUUUUDRRDLDUUURDUUDUDDURUDRLDRRUURDUDDRRDDDULDRURDUURDUUDDRRDLRURRDUUDLDLRDULLLDDRLDRRLURLUUDRDDUDLDULDLRDDUUURRURURDUUDULULDDDRL...

output:

491

result:

ok 1 number(s): "491"

Test #30:

score: 0
Accepted
time: 65ms
memory: 63772kb

input:

RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

1125750

result:

ok 1 number(s): "1125750"

Test #31:

score: 0
Accepted
time: 52ms
memory: 63404kb

input:

DUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDU...

output:

1125750

result:

ok 1 number(s): "1125750"

Test #32:

score: 0
Accepted
time: 52ms
memory: 32692kb

input:

RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRD...

output:

751

result:

ok 1 number(s): "751"

Test #33:

score: 0
Accepted
time: 592ms
memory: 122968kb

input:

LULDRUDLRRRRDRLRUUURDUUDLLUURDLRDRDDDURLUUDLRLRLUDRURDRRUDLRRLRURDDURURDRLULUULRDDLDLDLRLLLRLRRRLUDDLUDLDLURLUUDDDLLDUDLDRUULRLRUUDRDUUDLDLLDDLRUULRLUUDRRDLLLDLDUULLDDDLDRRRDDDDUUUULLLULRLLLLLDDDLLRDLDULDDDLRULRRDUULRLULRRDULDUULDURLRLDDLLLLRLLULDLRLDRRDLRULDRDDLDLUUUULUUDUDRDULUDRUDLUULRLRULULLUDRU...

output:

936

result:

ok 1 number(s): "936"

Test #34:

score: 0
Accepted
time: 270ms
memory: 121136kb

input:

RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

4501500

result:

ok 1 number(s): "4501500"

Test #35:

score: 0
Accepted
time: 204ms
memory: 120992kb

input:

DUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDU...

output:

4501500

result:

ok 1 number(s): "4501500"

Test #36:

score: 0
Accepted
time: 199ms
memory: 63516kb

input:

RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRD...

output:

1501

result:

ok 1 number(s): "1501"

Test #37:

score: 0
Accepted
time: 1729ms
memory: 200900kb

input:

RDDUDLRDLDURULULDLDUDRDLDUDLUDLRUDLDDLLLDRRLLUURDLLRURLDRDDLLDDRDLLRULRLLUUDDULUDLLDLURRULDDRUDDURLDUURDUUULRRRULUDLRDUDLULDRUDUDLDDRRUURRDDRLRLRULURRRLRRRRURDRRLLURUDDDDDRDRDLRDLRRRLRURRRDRUDDLLUDULRULDDRLLUUUUDDULDRLDRRDULLDLDDRRLDLDRRRRDRRLDRURUDLDDDLLLURDDUDRURUUDRRRUDRRLRRLRDLDUDRRDDLLURRLRDDLR...

output:

1482

result:

ok 1 number(s): "1482"

Test #38:

score: 0
Accepted
time: 789ms
memory: 198960kb

input:

RLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRLRL...

output:

12502500

result:

ok 1 number(s): "12502500"

Test #39:

score: 0
Accepted
time: 586ms
memory: 200632kb

input:

DUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDUDU...

output:

12502500

result:

ok 1 number(s): "12502500"

Test #40:

score: 0
Accepted
time: 549ms
memory: 102572kb

input:

RDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRDRD...

output:

2501

result:

ok 1 number(s): "2501"

Test #41:

score: -100
Time Limit Exceeded

input:

LRRDULLRRUULUDUULRLLLUUDRDRLDRRLURUDRDUULRUULLRRRRDUDLLDURUUURDDRURDLRRRURRUURRULULDRUURURDLDUURRLDURDLUUDRDRLRURLLLLDLULRUUUURRRUDULRLULRLUDDULULLDRLRULRDRLRRLDDDUDUUUUDDDRUDDRDDUURDUUULLURULUDRUURDULLUDLRLDDRRUUULRLDLLULLDURLDUUDDRLLRUDDLDULRRDDDURLRRRDLDRDRDDLDULURUDRLURRUUDRDDRLDDDRDDDUDLDRUDURU...

output:


result: