submission link, problem link, Could someone please help me understand the cause of the error? Additionally, i would appreciate general insights into which operations in C++ are typically slow and tips on how to optimize them. Thank You
# | 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 | 160 |
3 | Um_nik | 160 |
5 | atcoder_official | 159 |
6 | djm03178 | 157 |
7 | adamant | 153 |
8 | luogu_official | 150 |
9 | awoo | 149 |
10 | TheScrasse | 146 |
submission link, problem link, Could someone please help me understand the cause of the error? Additionally, i would appreciate general insights into which operations in C++ are typically slow and tips on how to optimize them. Thank You
Hi friends,please help me solve this if you have some spare time :)
a[1]-2*x[1]+x[n]=m;
a[2]-2*x[2]+x[1]=m;
a[3]-2*x[3]+x[2]=m;
. . .
a[n]-2*x[n]+x[n-1]=m;
here the array a is given and the constant m is also given,we have to find out the values of all the xi's in my approach i applied binary search on the value of x[n]..so lets suppose the assumed value of x[n]=mid then after solving the equation if i will get the value of x[n]>mid then i will reduce the mid,else increase the mid till the value of x[n] found out==mid...the problem here is that i have to find out an integral solution of the equations(if it exists)..so while solving the equations if some x[i] comes out to be a fractional value then we cannot proceed further with that value of mid..so if this happens then the current mid isnt a solution..now what should be the next mid value?increase/decrease or adjust it differently to converge to an integer solution(if it exists)?
last question:is there some other way in which this problem can be solved?
Name |
---|