Submission #619846

#TimeUsernameProblemLanguageResultExecution timeMemory
619846A_DAliens (IOI16_aliens)C++14
Compilation error
0 ms0 KiB
#include "aliens.h" #include <bits/stdc++.h> using namespace std; const int N=5e2+11; const long long LINF = 1e18; long long dp[N][N]; pair<long long,long long> a[N]; pair<long long,long long> b[N]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { vector<pair<long long,long long>> vec; for(int j=1;j<=n;j++){ dp[0][j]=1e18; dp[j][0]=1e18; } for(int i=0;i<n;i++){ if(r[i]<c[i])swap(r[i],c[i]); a[i+1]={r[i],c[i]}; } sort(a+1,a+n+1); pair<long long,long long> lst=a[n]; vec.push_back(lst); for(int i=n-1;i>=1;i--){ if(a[i].second>=lst.second){ a[i]={-1,-1}; } else{ lst=a[i]; vec.push_back(lst); } } n=vec.size(); for(int i=0;i<n;i++){ a[i+1]=vec[i]; } for(int i=1;i<=n;i++){ for(int j=1;j<=k;j++){ long long ret=1e18; for(int h=i;h>=1;h--){ mn=min(mn,a[h].second); mx=max(mx,a[h].first); if(dp[h-1][j-1]==1e18)continue; long long u=(a[i].first-a[h].second+1)*(a[i].first-a[h].second+1); long long f=0; if(a[h-1].first>=a[h].second){ f=(a[h-1].first-a[h].second+1)*(a[h-1].first-a[h].second+1); } ret=min(ret,u-f); } dp[i][j]=ret; } } // cout<<dp[0][0]<<" "<<dp[1][1]<<"\n"; long long ret=1e18; for(int i=1;i<=k;i++){ ret=min(ret,dp[n][i]); } return ret; }

Compilation message (stderr)

aliens.cpp: In function 'long long int take_photos(int, int, int, std::vector<int>, std::vector<int>)':
aliens.cpp:46:17: error: 'mn' was not declared in this scope; did you mean 'n'?
   46 |                 mn=min(mn,a[h].second);
      |                 ^~
      |                 n
aliens.cpp:47:17: error: 'mx' was not declared in this scope; did you mean 'm'?
   47 |                 mx=max(mx,a[h].first);
      |                 ^~
      |                 m