Submission #103776

#TimeUsernameProblemLanguageResultExecution timeMemory
103776figter001Aliens (IOI16_aliens)C++17
0 / 100
3 ms408 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; const int nax = 4010; int dp[nax][nax]; pair<int,int> p[nax]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { for(int i=0;i<=n;i++) for(int j=0;j<=k;j++) dp[j][i] = 1e9; for(int i=1;i<=n;i++) p[i] = {r[i-1],c[i-1]}; sort(p+1,p+n+1); dp[0][0] = 0; for(int u=1;u<=k;u++){ for(int i=1;i<=n;i++){ int x = p[i].first; int y = p[i].second; for(int l = 1;l<=i;l++){ int sz = (x - p[l].first + 1) * (x - p[l].first + 1); dp[u][i] = min(dp[u][i],dp[u-1][l-1] + sz); } } } return dp[k][n]; }

Compilation message (stderr)

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:25:8: warning: unused variable 'y' [-Wunused-variable]
    int y = p[i].second;
        ^
#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...