(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #369106

#TimeUsernameProblemLanguageResultExecution timeMemory
369106rumen_mPacking Biscuits (IOI20_biscuits)C++17
100 / 100
86 ms1004 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, (1LL<<a)) + solve(x, min(n, b[a]/x + 1)-(long long)(1LL<<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]*(1LL<<i); b.push_back(a[i]); } for(i;i<=60;i++) b.push_back(b.back()); long long ans = solve(x,b.back()+1); return ans; }

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;
      |                 ^
#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...