# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1076287 | hasan2006 | Aliens (IOI16_aliens) | C++17 | 58 ms | 4460 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 "aliens.h"
#include <bits/stdc++.h>
using namespace std;
#define TL ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define rall(s) s.rbegin(),s.rend()
#define all(s) s.begin(),s.end()
#define pb push_back
#define se second
#define fi first
#define ll long long
#define ld long double
#define YES cout<<"YES\n"
#define Yes cout<<"Yes\n"
#define yes cout<<"yes\n"
#define NO cout<<"NO\n"
#define No cout<<"No\n"
#define no cout<<"no\n"
const int N = 5e3 + 9 , mod = 1e9 + 7;
ll a[N] , b[N] , dp[N][N] , c[N] , d[N] ;
long long take_photos(int n, int m, int k, std::vector<int> a, std::vector<int> b) {
ll i , j , l , s = 0 , f , x , y ;
set<int>st;
vector<int>v;
for(i = 0; i < n; i++)
st.insert(a[i]);
v.pb(0);
for(auto to : st)
v.pb(to);
n = v.size() - 1;
for(i = 0; i <= n; i++)
for(j = 0; j <= n; j++)
dp[i][j] = 1e18;
dp[0][0] = 0;
ll mn = 1e18;
for(int i = 1; i <= n; i++) {
for(j = 1; j <= min(k , i); j++) {
dp[i][j] = min(dp[i][j] , dp[i][j - 1]);
for(x = 1; x <= i; x++)
dp[i][j] = min(dp[i][j] , dp[x - 1][j - 1] + (v[i] - v[x] + 1) * (v[i] - v[x] + 1));
if(i == n)
mn = min(mn , dp[i][j]);
}
}
return mn;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |