fork download
  1. int lower_solve(LL N) { return 5*(log(N)/log(4)) - 0.1; }
  2.  
  3. unordered_map<LL,int> memo;
  4. int solve(LL N) {
  5. if (N == 0) return 0;
  6. if (memo.count(N)) return memo[N];
  7. int res = min(1000ll, N);
  8. for (int mul = 2; mul + 1 < res; mul++) {
  9. int add = N % mul;
  10. if (add + mul + 1 + lower_solve(N / mul) >= res) continue;
  11. int ris = add + mul + 1 + solve(N / mul);
  12. res = min(res, ris);
  13. }
  14.  
  15. memo[N] = res;
  16. return res;
  17. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:17: error: ‘LL’ was not declared in this scope
 int lower_solve(LL N) { return 5*(log(N)/log(4)) - 0.1; }
                 ^~
prog.cpp:3:1: error: ‘unordered_map’ does not name a type
 unordered_map<LL,int> memo;
 ^~~~~~~~~~~~~
prog.cpp:4:11: error: ‘LL’ was not declared in this scope
 int solve(LL N) {
           ^~
stdout
Standard output is empty