Submission #1146412

#TimeUsernameProblemLanguageResultExecution timeMemory
1146412brianhdzmdoWall (IOI14_wall)C++20
Compilation error
0 ms0 KiB
#include "wall.h"
#include <algorithm>
#include <cmath>
#include <iostream>
#include <math.h>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <climits>

#define all(a) (a).begin(), (a).end()
#define allr(a) (a).rbegin(), (a).rend()
#define ll long long
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define fr1(i, a, b) for (ll i = a - 1; i >= b; i--)
#define fi first
#define se second
#define mp(j, k) make_pair(j, k)
#define pb(x) push_back(x)
#define pbp(x, y) push_back({x, y})
#define in(x) insert(x)
#define vec vector<ll>
#define vecv vector<vector<ll> >
#define veb vector<bool>
#define vecp vector<pair<ll,ll>>
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define ac 1e-7
#define fauto(a)   \
  for (auto i : a) \
    cout << i << " ";
#define fautop(a)  \
  for (auto i : a) \
    cout << i.fi << " " << i.se << endl;

using namespace std;

void buildWall(ll n, ll k, ll op[], ll left[], ll right[], ll height[], ll finalHeight[])
{
    fr(i, 0, k)
    {
        ll l = left[i];
        ll r = right[i];
        ll h = height[i];
        
        if(op[i] == 1) 
        {
            fr(i, l, r + 1)
            {
                if(finalHeight[i] < h)
                {
                    ll ax = h - finalHeight;
                    finalHeight[i] += ax;
                }
            }
        }
        else 
        {
           fr(i, l, r + 1)
           {
                if(finalHeight[i] > h)
                {
                    ll ax = finalHeight[i] - h;
                    finalHeight[i] -= ax;
                }
           }
        }
    }

    return finalHeight;
}

Compilation message (stderr)

wall.cpp: In function 'void buildWall(long long int, long long int, long long int*, long long int*, long long int*, long long int*, long long int*)':
wall.cpp:55:31: error: invalid operands of types 'long long int' and 'long long int*' to binary 'operator-'
   55 |                     ll ax = h - finalHeight;
      |                             ~ ^ ~~~~~~~~~~~
      |                             |   |
      |                             |   long long int*
      |                             long long int
wall.cpp:73:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   73 |     return finalHeight;
      |            ^~~~~~~~~~~