# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
800575 | Theo830 | Liteh and Newfiteh (INOI20_litehfiteh) | C++17 | 2 ms | 2644 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for(ll i = a;i < b;i++)
#define pb push_back
#define ii pair<ll,ll>
#define iii pair<ll,ii>
#define F first
#define S second
ll exo[100005][18][18];
const ll INF = 1e9;
ll dp[100005];
ll n;
ll solve(ll idx){
if(idx == n){
return 0;
}
if(dp[idx] != -1){
return dp[idx];
}
ll ans = INF;
f(j,0,18){
if(idx + (1<<j) > n){
break;
}
ans = min(ans,solve(idx + (1<<j)) + exo[idx][0][j]);
}
cout<<idx<<" "<<ans<<"\n";
return dp[idx] = ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |