Submission #719722

# Submission time Handle Problem Language Result Execution time Memory
719722 2023-04-06T14:21:17 Z ovidiush11 Wall (IOI14_wall) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "wall.h"
 
using namespace std;
 
#define mp make_pair
#define ff first
#define ss second
#define ll long long
 
const ll inf = 1e18;

vector<pair<ll,ll>> a;
vector<int> pos;
vector<queue<int>> vq;
 
void build(int p,int l,int r)
{
    if(l == r)pos[l] = p;
    else
    {
        int m = (l + r) / 2;
        build(p*2,l,m);
        build(p*2+1,m+1,r);
    }
    a[p] = mp(0,inf);
    return ;
}
 
void change(int p)
{
    if(p == 0)return ;
    ll mx = min(a[p*2].ss,a[p*2+1].ss);
    ll mn = max(a[p*2].ff,a[p*2+1].ff);
    if(mn > mx)
    {
        if(mn == a[p*2+1].ff)mx = mn;
        else mn = mx;
    }
    a[p] = mp(mn,mx);
    change(p/2);
    return ;
}
 
void buildWall(int N, int K, int op[], int left[], int right[], int height[], int finalHeight[])
{
    a.resize(N * 4);
    pos.resize(N);
    vq.resize(N);
    build(1,0,K-1);
    for(int i = 0;i < K;i++)vq[left[i]].push(i+1);
    for(int i = 0;i < K;i++)vq[right[i]].push(-i-1);
    for(int i = 0;i < N;i++)
    {
        while(!vq[i].empty() && vq[i].front() > 0)
        {
            int v = vq[i].front();
            vq[i].pop();
            v--;
            if(op[v] == 1)a[pos[v]].ff = height[v];
            else a[pos[v]].ss = height[v];
            change(pos[v]/2);
        }
        finalHeight[i] = a[1].ff;
        //cout<<finalHeight<<endl;
        while(!vq[i].empty())
        {
            int v = vq[i].front();
            vq[i].pop();
            v++;
            a[pos[-v]] = mp(0,inf);
            change(pos[-v]/2);
        }
    }
    return ;
}

Compilation message

wall.cpp:33:2: error: extended character   is not valid in an identifier
   33 |     ll mx = min(a[p*2].ss,a[p*2+1].ss);
      |  ^
wall.cpp:33:5: error: extended character   is not valid in an identifier
   33 |     ll mx = min(a[p*2].ss,a[p*2+1].ss);
      |    ^
wall.cpp:34:2: error: extended character   is not valid in an identifier
   34 |     ll mn = max(a[p*2].ff,a[p*2+1].ff);
      |  ^
wall.cpp:34:5: error: extended character   is not valid in an identifier
   34 |     ll mn = max(a[p*2].ff,a[p*2+1].ff);
      |    ^
wall.cpp: In function 'void change(int)':
wall.cpp:33:2: error: '\U000000a0' was not declared in this scope
   33 |     ll mx = min(a[p*2].ss,a[p*2+1].ss);
      |  ^
wall.cpp:34:4: error: expected ';' before '\U000000a0ll'
   34 |     ll mn = max(a[p*2].ff,a[p*2+1].ff);
      |   ^~~~
      |   ;
wall.cpp:35:8: error: 'mn' was not declared in this scope; did you mean 'yn'?
   35 |     if(mn > mx)
      |        ^~
      |        yn
wall.cpp:35:13: error: 'mx' was not declared in this scope; did you mean 'mp'?
   35 |     if(mn > mx)
      |             ^~
      |             mp
wall.cpp:40:15: error: 'mn' was not declared in this scope; did you mean 'yn'?
   40 |     a[p] = mp(mn,mx);
      |               ^~
      |               yn
wall.cpp:40:18: error: 'mx' was not declared in this scope; did you mean 'mp'?
   40 |     a[p] = mp(mn,mx);
      |                  ^~
      |                  mp