제출 #1167962

#제출 시각아이디문제언어결과실행 시간메모리
1167962alir3za_zar3Wall (IOI14_wall)C++20
컴파일 에러
0 ms0 KiB
// Alir3za.Zar3 -> Shiraz , Iran #include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int mxN = 2e6+7; int n,q , out[mxN]; const int base_min = -1; const int base_max = mxN; struct SEGMENT { struct NODE { int min=0 , minlzy=base_min; int max=0 , maxlzy=base_max; }; NODE T[mxN<<2]; int nw=1 , L[mxN<<2],R[mxN<<2]; tuple<int,int,int> info (int node , int l , int r) { int o=l+r>>1 , lc , rc; if (L[node]) lc = L[node]; else lc = L[node] = ++nw; if (R[node]) rc = R[node]; else rc = R[node] = ++nw; return {o , lc , rc}; } void apply (int typ , int v , int node) { if (!typ) { T[node].min = max(T[node].min,v); T[node].minlzy = max(T[node].minlzy,v); T[node].max = max(T[node].max,v); } else { T[node].max = min(T[node].max,v); T[node].maxlzy = min(v,T[node].maxlzy); T[node].min = min(T[node].min,v); } } void shift (int node , int l , int r) { if (l == r-1) return; auto [o , lc , rc] = info(node , l , r); if (T[node].minlzy != base_min) { apply(0 , T[node].minlzy , lc); apply(0 , T[node].minlzy , rc); } if (T[node].maxlzy != base_max) { apply(1 , T[node].maxlzy , lc); apply(1 , T[node].maxlzy , rc); } T[node].minlzy = base_min; T[node].maxlzy = base_max; } void update (int lq , int rq , int typ , int v , int node=1 , int l=0 , int r=n) { if (r<=lq or l>=rq) return; if (lq<=l and r<=rq) { apply(typ , v , node); return; } shift(node , l , r); auto [o , lc , rc] = info(node , l , r); update(lq , rq , typ , v , lc , l , o); update(lq , rq , typ , v , rc , o , r); T[node].min = min(T[lc].min,T[rc].min); T[node].max = max(T[lc].max,T[rc].max); } int query (int id , int node=1 , int l=0 , int r=n) { if (T[node].min == T[node].max) return T[node].min; shift(node , l , r); auto [o , lc , rc] = info(node , l , r); if (id < o) return query(id , lc , l , o); else return query(id , rc , o , r); } } segmenT; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> q; while (q--) { int typ , l , r , v; cin >> typ >> l >> r >> v; segmenT.update(l,++r,--typ,v); } for (int i=0; i<n; i++) cout << segmenT.query(i) << '\n'; }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/cc3983Ju.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cciHRqkE.o:wall.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc3983Ju.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