NafisAlam's blog

By NafisAlam, history, 16 months ago, In English

Can someone explain to me why did I get MLE? 580C - Kefa and Park MLE : 216547229 AC : 216548333

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By NafisAlam, history, 18 months ago, In English

Need help figuring out why this code is getting TLE. Problem link : 1829D - Gold Rush

void solve1829D()
{
   int n, m, cnt = 0;
   cin >> n >> m;
   set<int> st;
   st.insert(n);
   while(st.size() > 0)
   {
      if(st.find(m) != st.end())
      {
         cout << "YES" << endl;
         return;
      }
      int x = *st.begin();
      st.erase(st.begin());
      if(x % 3 == 0) {st.insert(x / 3); st.insert((x * 2) / 3);}
   }
   cout << "NO" << endl;
}

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it

By NafisAlam, 22 months ago, In English

Can someone help me understand the time complexity of submission #1 and #2? I don't understand why I got TLE on submission #1.

problem link : 1714E - Add Modulo 10

TLE submission #1 : 191420410

TLE submission #2 : 191295823

Thanks for your help.

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it