# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070758 | AdamGS | Permutation (APIO22_perm) | C++17 | 329 ms | 8272 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;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e6+7;
ll dp[LIM];
bool pre=false;
void prepro() {
rep(i, LIM) dp[i]=LIM;
dp[1]=0;
dp[2]=1;
for(int n=3; n<LIM; ++n) {
for(int i=1; i<=20; ++i) if(n-i-1>0) dp[n]=min(dp[n], dp[n-i]+dp[i+1]);
for(int i=2; i<=100; ++i) if(n%i==0) dp[n]=min(dp[n], dp[n/i]+dp[i]);
}
ll ans=0;
for(int i=1; i<LIM; ++i) ans=max(ans, dp[i]);
}
vector<int>mnoz(vector<int>A, vector<int>B) {
ll x=A.size();
for(auto i : B) A.pb(i+x);
return A;
}
vector<int>dodaj(vector<int>A, vector<int>B) {
rep(i, A.size()) A[i]+=B.size();
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |