CLLEXO EDITORIAL

Can you share link on online ide? Or the test case it fails?

Very strange. Maybe there are some memory issues with my solution because it passes the specific test case alone on all online ides as well as codechef ide. Can you share link on any online ide where some testcase fails. Thank you.

@cubefreak777
It fails for this testcase
1
2 4
qsrp
qrss

1 Like

I am not objecting, but I am slightly puzzled. The question specifies a time limit of 2 seconds, yet my submission CodeChef: Practical coding for everyone passed with a time of 3.31 seconds. How come? Are time limits scaled for different languages (I am using Python 3, using the PyPy3 compiler)?

@aberent
Here in CodeChef, we have different time multiplers for different compilers.
You can learn more about it here.

1 Like

Thanks @avijit_agarwal, this testcase helped me getting AC too

@avijit_agarwal could you help me know why this o(n*m) solution is TLE. Thanks CodeChef: Practical coding for everyone 10

hi @swapnil159
https://www.codechef.com/viewsolution/35703437
can you explain why i am getting tle in this??

Can someone look at My solution
i simply used DP algo for finding a path from [1,1] to [n,m] with ‘#’ as blocks
I don’t know on which test case it failed.
@avijit_agarwal @aman_robotics

Fails for
1
1 1
b

Edit: It gives RE on codechef IDE

And it should give wrong anser then why tle??

@avijit_agarwal @swapnil159
Can you tell me what test cases my code is failing? I have been stuck for hours.
My soluton

Can anybody Please help me, I used the given approach but gettind WA. I tested for myself but not able to find the error.

#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin>>t;
    while(t--)
    {
        int n,m;
        cin>>n>>m;
        vector<string> strs(n);
        for(int i=0;i<n;i++)    cin>>strs[i];
        //each string has size m
        set<pair<char,pair<int,int> > > set_of_truth;
        set_of_truth.insert({strs[0][0],{0,0}});
        string res="";
        while(set_of_truth.size())
        {
            char smallest=set_of_truth.begin()->first;
            res+=smallest;
            vector<pair<int,int>> potential_candidates;
            while(set_of_truth.size() && set_of_truth.begin()->first==smallest)
            {
                potential_candidates.push_back({set_of_truth.begin()->second.first,set_of_truth.begin()->second.second});
                set_of_truth.erase(set_of_truth.begin());
            }
            set_of_truth.clear();
            for(int i=0;i<potential_candidates.size();i++)
            {
                int r=potential_candidates[i].first;
                int c=potential_candidates[i].second;
                if(r+1<n && strs[r+1][c]!='#') set_of_truth.insert({strs[r+1][c],{r+1,c}});
                if(c+1<m && strs[r][c+1]!='#')   set_of_truth.insert({strs[r][c+1],{r,c+1}});
            }
        }
        cout<<res<<endl;
    }
}

@avijit_agarwal I tried dfs approach
Can you tell me whats wrong in the code
https://www.codechef.com/viewsolution/35708838

@garyhost
It seems yesterday was your unlucky day. But we always guarantee the participants to learn something new. It seems you did an inefficeient string concatenation in your program at line 220.
ans=ans+ minch;
Instead you should have done,
ans+=minch;
You may look at this post for explanation
Hope it helps :slightly_smiling_face:

1 Like

Wow…thank you so much for the help. Really came across this issue for the first time. Indeed this was the problem. Yesterday was unlucky but now I know the mistake and will make sure to be careful about this.

1 Like

@priyanshu219
Read the question carefully. You are required to print the lexicographically smallest string.

I had to a nap to understand this editorial …xD

@avijit_agarwal @swapnil159 @galencolin
Please help me in finding what test cases my code is failing. I have spent hours on this.
My solution

@summerbrander
Your solution is failing for this testcase-
1
6 3
rqq
qsq
qss
rsq
pss
sqq
correct output: rqqqsqsq

1 Like