# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
671066 | arnold518 | Permutation (APIO22_perm) | C++17 | 995 ms | 80084 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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9+7;
ll K;
unordered_map<ll, int> M;
int f(ll x)
{
if(x==1) return 0;
if(x==0) return INF;
if(M.find(x)!=M.end()) return M[x];
int ret=INF;
for(int i=2; i<=7; i++)
{
if(i==4) continue;
ret=min((ll)ret, f(x/i)+i+x%i-1);
}
return M[x]=ret;
}
void restore(ll x, vector<pii> &V)
{
if(x==1) return;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |