Submission #719720

# Submission time Handle Problem Language Result Execution time Memory
719720 2023-04-06T14:20:12 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 ;    int mx = min(a[p*2].ss,a[p*2+1].ss);    int 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:1:25: warning: extra tokens at end of #include directive
    1 | #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 ;    int mx = min(a[p*2].ss,a[p*2+1].ss);    int 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 ;}
      |                         ^
/usr/bin/ld: /tmp/ccTKnUEZ.o: in function `main':
grader.cpp:(.text.startup+0x133): undefined reference to `buildWall(int, int, int*, int*, int*, int*, int*)'
collect2: error: ld returned 1 exit status