in problem E, i have another approach to calculate the operation. the operation needed for any number is ( log3 n)+1 since we cannot use 3 as base in cpp, so we can write this as ((log2 n)/(log2 3))+1. I guess this is O(1) operation.
@@jayrathod7957 the log function uses hardware-level instructions or highly optimized algorithms to compute the logarithm of a number, making the computation constant time regardless of the input size. I had read this in some article(gfg , stack overflow) and some AI also.
Problem E - > Plz compile this code and told me error this give me TLE ON 2ND TEST CASE #include #include using namespace std; int main() { int n; cin >> n; vector answr; for (int i = 0; i < n; i++) { int a = 0; int b = 0; cin >> a; cin >> b; vector dp(200001, -1); vector prefixsum(200001); for (int i = a; i
A big thanks for the hard work you are doing by sacrificing your sleep and time to help us learn more🛐
in problem E, i have another approach to calculate the operation.
the operation needed for any number is ( log3 n)+1 since we cannot use 3 as base in cpp, so we can write this as ((log2 n)/(log2 3))+1. I guess this is O(1) operation.
tried doing this but gave me WA
yeah , log is inbuilt fun
but it doesn't means its O(1)
it is O(log)
i tried same then got idea of it
@@jayrathod7957 the log function uses hardware-level instructions or highly optimized algorithms to compute the logarithm of a number, making the computation constant time regardless of the input size. I had read this in some article(gfg , stack overflow) and some AI also.
Today I have learnt something new from your upsolve session sir.
😊😊
Great Explanation ❤❤❤❤❤❤
Can anyone tell me codeforces conduct contest on Wednesday or Tuesday? Also the timing?
clist.by/ or codeforces.com/contests
7 Crore🫡
Problem E - > Plz compile this code and told me error this give me TLE ON 2ND TEST CASE
#include
#include
using namespace std;
int main()
{
int n;
cin >> n;
vector answr;
for (int i = 0; i < n; i++)
{
int a = 0;
int b = 0;
cin >> a;
cin >> b;
vector dp(200001, -1);
vector prefixsum(200001);
for (int i = a; i