Submission #28743

#TimeUsernameProblemLanguageResultExecution timeMemory
28743repeatingAliens (IOI16_aliens)C++11
12 / 100
139 ms3020 KiB
#include <bits/stdc++.h> #include "aliens.h" #define F first #define S second #define P push #define pb push_back #define MEM(dp,i) memset(dp,i,sizeof(dp)) #define W while #define R return #define C continue #define SI size() #define ll long long #define ld long double #define pll pair<ll,ll> #define pii pair<int,int> #define SF(x) scanf("%I64d",&x) #define SF2(x,y) scanf("%I64d%I64d",&x,&y) #define SF3(x,y,z) scanf("%I64d%I64d%I64d",&x,&y,&z) #define SF4(x,y,z,o) scanf("%I64d%I64d%I64d%I64d",&x,&y,&z,&o) #define all(v) v.begin(),v.end() using namespace std; const long long INF = 1e8; const int MX=200015; int n,m,k; int dp[505][505]; int a[505]; int DP(int x,int y){ if(x==n)R 0; if(y==k)R INF; int &ret=dp[x][y]; if(ret!=-1)R ret; ret=INF; for(int i=x;i<n;i++){ ret=min(ret,DP(i+1,y+1)+(a[i]-a[x]+1)*(a[i]-a[x]+1)); } R ret; } long long take_photos(int n_, int m_, int k_, vector<int> r, vector<int> c) { MEM(dp,-1); n=n_,m=m_,k=k_; for(int i=0;i<n;i++){ a[i]=r[i]; } sort(a,a+n); return DP(0,0); }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...