Can someone explain to me why did I get MLE? 580C - Кефа и парк MLE : 216547229 AC : 216548333
# | User | Rating |
---|---|---|
1 | jiangly | 3898 |
2 | tourist | 3840 |
3 | orzdevinwang | 3706 |
4 | ksun48 | 3691 |
5 | jqdai0815 | 3682 |
6 | ecnerwala | 3525 |
7 | gamegame | 3477 |
8 | Benq | 3468 |
9 | Ormlis | 3381 |
10 | maroonrk | 3379 |
# | User | Contrib. |
---|---|---|
1 | cry | 168 |
2 | -is-this-fft- | 165 |
3 | Dominater069 | 161 |
4 | Um_nik | 160 |
5 | atcoder_official | 159 |
6 | djm03178 | 157 |
7 | adamant | 153 |
8 | luogu_official | 150 |
9 | awoo | 149 |
10 | TheScrasse | 146 |
Can someone explain to me why did I get MLE? 580C - Кефа и парк MLE : 216547229 AC : 216548333
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;
}
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.
Name |
---|