제출 #135730

#제출 시각아이디문제언어결과실행 시간메모리
135730ckodserAliens (IOI16_aliens)C++14
컴파일 에러
0 ms0 KiB
#include "aliens.h" #include<bits/stdc++.h> #define ll int #define pb push_back #define mp make_pair #define ld long double #define F first #define S second #define pii pair<ll,ll> using namespace :: std; const ll maxn=4100; const ll maxk=4010; const ll inf=1e9+900; const ll logg=20; ll tav2(ll x){ return x*x; } ll mxx[maxn]; ll dp[maxn][maxk]; vector<ll> imp; ll cost(ll i,ll x){ ll t=findMn(x+1,i); if(x!=-1 && mx[x]>=t){ return inf; }if(t>x){ return tav2(i-t+1); } return tav2(i-t+1)-tav2(x-t+1); } ll mx[maxn]; long long take_photos(int n, int m, int k, vector<int> r, vector<int> c) { swap(n,m); fill(mx,mx+maxn,inf); fill(mxx,mxx+maxn,inf); for(ll i=0;i<m;i++){ if(c[i]>r[i]){ swap(c[i],r[i]); } mx[r[i]]=min(mx[r[i]],(ll)c[i]); } stack<ll> stk; for(ll i=0;i<n;i++){ while(stk.size() && mx[stk.top()]>=mx[i]){ stk.pop(); } if(mx[i]!=inf){ stk.push(i); } } while(stk.size()){ mxx[stk.top()]=mx[stk.top()]; stk.pop(); } for(ll i=0;i<n;i++){ if(mxx[i]!=inf)imp.pb(i); } for(ll j=1;j<=k;j++){ for(auto i:imp){ dp[i][j]=inf; for(auto x:imp){ if(x==i)break; dp[i][j]=min(dp[i][j],dp[x][j-1]+cost(i-1,x-1)); } if(i==0){ dp[i][j]=0; } } } return dp[imp.back()][k]; }

컴파일 시 표준 에러 (stderr) 메시지

aliens.cpp: In function 'int cost(int, int)':
aliens.cpp:29:10: error: 'findMn' was not declared in this scope
     ll t=findMn(x+1,i);
          ^~~~~~
aliens.cpp:29:10: note: suggested alternative: 'rindex'
     ll t=findMn(x+1,i);
          ^~~~~~
          rindex
aliens.cpp:30:17: error: 'mx' was not declared in this scope
     if(x!=-1 && mx[x]>=t){
                 ^~
aliens.cpp:30:17: note: suggested alternative: 'x'
     if(x!=-1 && mx[x]>=t){
                 ^~
                 x