Submission #619813

#TimeUsernameProblemLanguageResultExecution timeMemory
619813A_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].first==-1&&a[i].seoncd==-1})continue; for(int j=1;j<=k;j++){ long long ret=1e18; long long mn=a[i].second; long long mx=a[i].first; for(int h=i;h>=1;h--){ if(a[h].first==-1&&a[h].seoncd==-1})continue; 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:33: error: 'struct std::pair<long long int, long long int>' has no member named 'seoncd'; did you mean 'second'?
   37 |         if(a[i].first==-1&&a[i].seoncd==-1})continue;
      |                                 ^~~~~~
      |                                 second
aliens.cpp:37:43: error: expected ')' before '}' token
   37 |         if(a[i].first==-1&&a[i].seoncd==-1})continue;
      |           ~                               ^
      |                                           )
aliens.cpp:37:43: error: expected primary-expression before '}' token
aliens.cpp:37:44: error: expected primary-expression before ')' token
   37 |         if(a[i].first==-1&&a[i].seoncd==-1})continue;
      |                                            ^
aliens.cpp:40:28: error: 'i' was not declared in this scope
   40 |             long long mn=a[i].second;
      |                            ^
aliens.cpp:43:41: error: 'struct std::pair<long long int, long long int>' has no member named 'seoncd'; did you mean 'second'?
   43 |                 if(a[h].first==-1&&a[h].seoncd==-1})continue;
      |                                         ^~~~~~
      |                                         second
aliens.cpp:43:51: error: expected ')' before '}' token
   43 |                 if(a[h].first==-1&&a[h].seoncd==-1})continue;
      |                   ~                               ^
      |                                                   )
aliens.cpp:43:51: error: expected primary-expression before '}' token
aliens.cpp:43:52: error: expected primary-expression before ')' token
   43 |                 if(a[h].first==-1&&a[h].seoncd==-1})continue;
      |                                                    ^
aliens.cpp:44:29: error: 'h' was not declared in this scope
   44 |                 mn=min(mn,a[h].second);
      |                             ^
aliens.cpp:50:16: error: 'i' was not declared in this scope
   50 |             dp[i][j]=ret;
      |                ^
aliens.cpp:50:19: error: 'j' was not declared in this scope
   50 |             dp[i][j]=ret;
      |                   ^
aliens.cpp:50:22: error: 'ret' was not declared in this scope
   50 |             dp[i][j]=ret;
      |                      ^~~
aliens.cpp:52:9: warning: no return statement in function returning non-void [-Wreturn-type]
   52 |         }
      |         ^
aliens.cpp: At global scope:
aliens.cpp:53:5: error: expected declaration before '}' token
   53 |     }
      |     ^
aliens.cpp:56:5: error: expected unqualified-id before 'for'
   56 |     for(int i=1;i<=k;i++){
      |     ^~~
aliens.cpp:56:17: error: 'i' does not name a type
   56 |     for(int i=1;i<=k;i++){
      |                 ^
aliens.cpp:56:22: error: 'i' does not name a type
   56 |     for(int i=1;i<=k;i++){
      |                      ^
aliens.cpp:59:5: error: expected unqualified-id before 'return'
   59 |     return ret;
      |     ^~~~~~
aliens.cpp:61:1: error: expected declaration before '}' token
   61 | }
      | ^