Submission #369103

#TimeUsernameProblemLanguageResultExecution timeMemory
369103rumen_mPacking Biscuits (IOI20_biscuits)C++17
0 / 100
1 ms620 KiB
#include "biscuits.h" #include <bits/stdc++.h> using namespace std; vector <long long> b; map <long long, long long> mp; long long solve(long long x, long long n) { if(n<=0)return 0; if(n==1)return 1; if(mp.find(n)!=mp.end()) return mp[n]; long long a = __lg(n-1); long long ans = solve(x,(1<<a)) + solve(x, min(n, b[a]/x + 1)-(1<<a)); mp[n] = ans; return ans; } long long count_tastiness(long long x, std::vector<long long> a) { long long i,j; b.clear(); mp.clear(); for(i=0;i<a.size();i++) { if(i) a[i] = a[i-1] + a[i]*(1<<i); b.push_back(a[i]); } for(i;i<=60;i++) b.push_back(b.back()); long long ans = solve(x,b.back()+1); }

Compilation message (stderr)

biscuits.cpp: In function 'long long int solve(long long int, long long int)':
biscuits.cpp:10:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   10 |     if(mp.find(n)!=mp.end())
      |     ^~
biscuits.cpp:12:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   12 |         long long a = __lg(n-1);
      |         ^~~~
biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:21:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for(i=0;i<a.size();i++)
      |             ~^~~~~~~~~
biscuits.cpp:27:9: warning: statement has no effect [-Wunused-value]
   27 |     for(i;i<=60;i++)
      |         ^
biscuits.cpp:18:17: warning: unused variable 'j' [-Wunused-variable]
   18 |     long long i,j;
      |                 ^
biscuits.cpp:29:15: warning: unused variable 'ans' [-Wunused-variable]
   29 |     long long ans = solve(x,b.back()+1);
      |               ^~~
biscuits.cpp:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
   31 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...