제출 #514502

#제출 시각아이디문제언어결과실행 시간메모리
514502enerelt14벽 (IOI14_wall)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; int n, q; struct node{ int lazy, mn, mx; node(){ lazy=-1; mn=0; mx=0; } }; node tree[8000005]; void propagate(int id, int l, int r){ if (l==r)return; if (tree[id].lazy!=-1){ tree[id*2+1].lazy=tree[id].lazy; tree[id*2+2].lazy=tree[id].lazy; tree[id*2+1].mn=tree[id].lazy; tree[id*2+1].mx=tree[id].lazy; tree[id*2+2].mn=tree[id].lazy; tree[id*2+2].mx=tree[id].lazy; } tree[id].mn=min(tree[id*2+1].mn, tree[id*2+2].mn); tree[id].mx=max(tree[id*2+1].mx, tree[id*2+2].mx); tree[id].lazy=-1; } void update1(int id, int l, int r, int L, int R, int h){ if (L>r || l>R || tree[id].mn>=h)return; if (L<=l && r<=R && tree[id].mn==tree[id].mx){ tree[id].lazy=max(tree[id].lazy, h); tree[id].mn=max(tree[id].mn, h); tree[id].mx=max(tree[id].mx, h); //cout<<id<<" "<<l<<" "<<r<<" "<<tree[id].lazy<<" "<<tree[id].mn<<" "<<tree[id].mx<<"\n"; return; } propagate(id, l, r); int m=(l+r)/2; update1(id*2+1, l, m, L, R, h); update1(id*2+2, m+1, r, L, R, h); tree[id].mn=min(tree[id*2+1].mn, tree[id*2+2].mn); tree[id].mx=max(tree[id*2+1].mx, tree[id*2+2].mx); } void update2(int id, int l, int r, int L, int R, int h){ if (L>r || l>R || tree[id].mx<=h)return; if (L<=l && r<=R && tree[id].mn==tree[id].mx){ if (tree[id].lazy!=-1)tree[id].lazy=min(tree[id].lazy, h); else tree[id].lazy=h; tree[id].mn=min(tree[id].mn, h); tree[id].mx=min(tree[id].mx, h); //cout<<id<<" "<<l<<" "<<r<<" "<<tree[id].lazy<<" "<<tree[id].mn<<" "<<tree[id].mx<<"\n"; return; } propagate(id, l, r); int m=(l+r)/2; update2(id*2+1, l, m, L, R, h); update2(id*2+2, m+1, r, L, R, h); tree[id].mn=min(tree[id*2+1].mn, tree[id*2+2].mn); tree[id].mx=max(tree[id*2+1].mx, tree[id*2+2].mx); } void solve(int id, int l, int r){ propagate(id, l, r); if (l==r){ cout<<tree[id].mn<<"\n"; return; } int m=(l+r)/2; solve(id*2+1, l, m); solve(id*2+2, m+1, r); } int main(){ cin>>n>>q; while(q--){ int x, y, z, t; cin>>x>>y>>z>>t; if (x==1)update1(0, 0, n-1, y, z, t); else update2(0, 0, n-1, y, z, t); } solve(0, 0, n-1); }

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

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