Submission #410660

#TimeUsernameProblemLanguageResultExecution timeMemory
410660Haruto810198Wall (IOI14_wall)C++17
Compilation error
0 ms0 KiB
#include "wall.h" #include <algorithm> using namespace std; #define int long long #define double long double #define FOR(i,l,r,d) for(int i=(l);i<=(r);i+=(d)) /* #define szof(x) ((x).size()) #define vi vector<int> #define pii pair<int,int> #define F first #define S second #define pb push_back #define eb emplace_back #define mkp make_pair */ //#pragma GCC optimize("Ofast") //#pragma GCC optimize("unroll-loops") #define V st[cidx] #define LC st[cidx*2] #define RC st[cidx*2+1] const int INF = 2147483647; //const int MOD = 1000000007; //const int mod = 998244353; //const double eps = 1e-12; const int MAX = 2000010; struct Node{ int sl, sr; int tagl, tagr; }; Node st[4*MAX]; void build(int cidx, int cl, int cr){ V.sl = cl; V.sr = cr; V.tagl = 0; V.tagr = 0; if(cl < cr){ int mid = (cl + cr) / 2; build(cidx*2, cl, mid); build(cidx*2+1, mid+1, cr); } } void addtag(int cidx, int mmin, int mmax){ if(mmin > V.tagr){ V.tagl = V.tagr = mmin; } else if(mmax < V.tagl){ V.tagl = V.tagr = mmax; } else{ V.tagl = max(V.tagl, mmin); V.tagr = min(V.tagr, mmax); } } void pushtag(int cidx){ if(V.sl < V.sr){ addtag(cidx*2, V.tagl, V.tagr); addtag(cidx*2+1, V.tagl, V.tagr); } V.tagl = -INF; V.tagr = INF; } void modify(int cidx, int ml, int mr, int mmin, int mmax){ if(mr<V.sl or V.sr<ml){ return; } else if(ml<=V.sl and V.sr<=mr){ addtag(cidx, mmin, mmax); return; } else{ pushtag(cidx); modify(cidx*2, ml, mr, mmin, mmax); modify(cidx*2+1, ml, mr, mmin, mmax); } } int query(int cidx, int qidx){ if(V.sl==qidx and V.sr==qidx){ return V.tagl; } else{ pushtag(cidx); int mid = (V.sl + V.sr) / 2; if(qidx <= mid){ return query(cidx*2, qidx); } else{ return query(cidx*2+1, qidx); } } } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]){ build(1, 0, n-1); FOR(i,0,k-1,1){ if(op[i]==1){ /// Max modify(1, left[i], right[i], height[i], INF); } else if(op[i]==2){ /// min modify(1, left[i], right[i], -INF, height[i]); } } FOR(i,0,n-1,1){ finalHeight[i] = query(1, i); } } /* int _n, _k; int _op[MAX], _left[MAX], _right[MAX], _height[MAX], _finalHeight[MAX]; signed main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>_n>>_k; FOR(i,0,_k-1,1){ cin>>_op[i]>>_left[i]>>_right[i]>>_height[i]; } buildWall(_n, _k, _op, _left, _right, _height, _finalHeight); FOR(i,0,_n-1,1){ cout<<_finalHeight[i]<<' '; } cout<<'\n'; return 0; } */

Compilation message (stderr)

/usr/bin/ld: /tmp/ccccYuky.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