Submission #619805

#TimeUsernameProblemLanguageResultExecution timeMemory
619805A_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; 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) { 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]; for(int i=n-1;i>=1;i--){ if(a[i].second>=lst.second){ a[i]={-1,-1}; } else{ lst=a[i]; } } for(int i=1;i<=n;i++){ if(a[i]=={-1,-1})continue; for(int j=1;j<=k;j++){ if(a[j]=={-1,-1})continue; long long ret=1e18; long long mn=a[i].second; long long mx=a[i].first; 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=(mx-mn+1)*(mx-mn+1)+dp[h-1][j-1]; ret=min(ret,u); } 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:37:18: error: expected primary-expression before '{' token
   37 |         if(a[i]=={-1,-1})continue;
      |                  ^
aliens.cpp:37:18: error: expected ')' before '{' token
   37 |         if(a[i]=={-1,-1})continue;
      |           ~      ^
      |                  )
aliens.cpp:39:22: error: expected primary-expression before '{' token
   39 |             if(a[j]=={-1,-1})continue;
      |                      ^
aliens.cpp:39:22: error: expected ')' before '{' token
   39 |             if(a[j]=={-1,-1})continue;
      |               ~      ^
      |                      )