| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3408 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 153 |
| 2 | nik_exists | 151 |
| 3 | maroonrk | 150 |
| 4 | maspy | 149 |
| 5 | AmShZ | 146 |
| 6 | Um_nik | 143 |
| 7 | Errichto | 139 |
| 8 | adamant | 135 |
| 9 | BledDest | 134 |
| 10 | cry | 130 |
|
0
It is showing invites are currently closed for this server |
|
0
I am in. Please send link |
|
0
Hey, I was using online compiler and didn't know that my code can be viewed by others. So sorry for this mistake. I will take care of it from the next time. As this was my first mistake I hope you will understand it and will not penalise me. I will make sure no such incident happen in future. Thanking You |
|
0
includeincludeincludeusing namespace std; typedef long long ll; bool solve1(ll n, ll x, vector& dp) { if (n == x) { return true; } if (x > n || n % 3 != 0) { return false; } if (dp[n] != -1) { return dp[n]; } bool ans = solve1(n / 3, x, dp) || solve1(2 * n / 3, x, dp); dp[n] = ans ? 1 : 0; return dp[n]; } void solve() { ll n, m; cin >> n >> m; vector dp(n + 1, -1); if (solve1(n, m, dp)) { cout << "YES" << endl; } else { cout << "NO" << endl; } } int main() { cin.tie(0); cin.sync_with_stdio(0); cout.tie(0); cout.sync_with_stdio(0); int t;
cin >> t;
while (t--) {
solve();
}
return 0;} Why this code is giving Time complexity in Problem D, ;Gold Rush? |
| Name |
|---|


