Submission #339532

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3395322020-12-25 15:27:05tengiz05Skyline (IZhO11_skyline)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> chmin(T& a, const T& b){return a>b?a=b,true:false;}
template<class T> chmax(T& a, const T& b){return a<b?a=b,true:false;}
const int N = 305;
int n;
int a[N];
int dp[N][N][N];
int get_ans(int x, int y){
int mn = min(x, y);
int mx = max(x, y);
return mn*5+(mx-mn)*3;
}
int calc(int i, int x, int y){
if(~dp[i][x][y])return dp[i][x][y];
int &ret = dp[i][x][y];
ret = 100000000;
if(i == n+1)return ret = get_ans(x, y);
if(x>0)chmin(ret, calc(i, x-1, y)+3);
if(x>0 && y>0)chmin(ret, calc(i,x-1,y-1)+5);
if(x == 0)chmin(ret, calc(i+1, y, a[i]));
if(x == min(x, min(y, a[i])))chmin(ret, calc(i+1, y-x, a[i]-x) + x*7);
return ret;
}
void Solve(){
cin >> n;
for(int i=1;i<=n;i++){
cin >> a[i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

skyline.cpp:4:41: error: ISO C++ forbids declaration of 'chmin' with no type [-fpermissive]
    4 | template<class T> chmin(T& a, const T& b){return a>b?a=b,true:false;}
      |                                         ^
skyline.cpp:5:41: error: ISO C++ forbids declaration of 'chmax' with no type [-fpermissive]
    5 | template<class T> chmax(T& a, const T& b){return a<b?a=b,true:false;}
      |                                         ^