[3sem] dsaa03 mod protecc and general fix
This commit is contained in:
parent
a8a525df81
commit
de1db8089d
1 changed files with 6 additions and 0 deletions
|
|
@ -8,6 +8,8 @@
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#undef IS_BIN_REQUIRED
|
||||||
|
|
||||||
|
|
||||||
inline void time_passed(std::chrono::system_clock::time_point start, double &holder) {
|
inline void time_passed(std::chrono::system_clock::time_point start, double &holder) {
|
||||||
auto stop = std::chrono::high_resolution_clock::now();
|
auto stop = std::chrono::high_resolution_clock::now();
|
||||||
|
|
@ -115,7 +117,11 @@ void algo_02(const num_list &cont, const num_type &num, num_type &found) { // O
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef IS_BIN_REQUIRED
|
||||||
|
c = (l + r) / 2;
|
||||||
|
#else
|
||||||
c = l + ((num - lv) * (r - l)) / (rv - lv);
|
c = l + ((num - lv) * (r - l)) / (rv - lv);
|
||||||
|
#endif
|
||||||
if (cont[c] < num) {
|
if (cont[c] < num) {
|
||||||
l = c + 1;
|
l = c + 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue