제출 #424120

#제출 시각아이디문제언어결과실행 시간메모리
424120SAAD벽 (IOI14_wall)C++17
컴파일 에러
0 ms0 KiB
#define F first #define S second #define rep(i,a,b) for(int i=a;!(a==b&&i!=b)&&((i<=b&&b>=a)||(i>=b&&a>=b));i+=(a<=b?1:-1)) #define pb push_back #define Fbitl __builtin_ffs #define bit1 __builtin_popcount //#include <bits/stdc++.h> #include <iostream> #include <math.h> #include <algorithm> #include <string.h> #include <vector> #include <queue> #include <map> #include <unordered_map> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef pair<string, string> pss; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pii> vii; typedef vector<ll> vl; typedef vector<vl> vvl; #include "wall.h" bool th ; int seg[(int)1e6 + 1] , L , R , num ; int n , nn ; void segmant ( int idx , int l , int r ) { if (idx >= nn+n) return; //cout << idx << " : (" << l <<','<<r<<")\n" ; if ( l >= L && r <= R ) { if ( th ) seg[idx] = (seg[idx]==-1?num:min(seg[idx],num)); else seg[idx] = (seg[idx]==-1?num:max(seg[idx],num)); } else if ( l > R || r < L ) return; else { segmant(idx*2,l,(l+r)/2); segmant((idx*2)+1,((l+r)/2)+1,r); } } int mx ( int idx ) { if (idx==1) return seg[1]; int res = max(seg[idx],mx(idx/2)); return res; } int mn ( int idx ) { if (idx==1) return (seg[1]==-1?(int)1e6:seg[1]); int res = min((seg[idx]==-1?(int)1e6:seg[idx]),mn(idx/2)); return res; } void buildWall(int n, int k, int op[], int left[], int right[],int height[], int finalHeight[]) { ::n = n; nn = (pow(2,(int)log2(n))==n?pow(2,(int)log2(n)):pow(2,(int)(log2(n))+1) ) ; int c = 0; while (op[c] == 1 && c < k) { num = height[c];L = left[c];R = right[c]; segmant(1,0,nn-1); c++; } for (int i=0;i<n;i++) { finalHeight[i] = mx(i+nn); //cout << i+nn << " " << finalHeight[i] << endl ; } memset(seg,-1,sizeof(seg)); th = true; while (op[c] == 2 && c < k) { num = height[c];L = left[c];R = right[c]; segmant(1,0,nn-1); c++; } for (int i=0;i<n;i++) finalHeight[i] = min(finalHeight[i],mn(i+nn)); } int main(){ int n , k; cin >> n >> k; int op[k],left[k],right[k],height[k],finalHeight[n]; for ( int i=0;i<k;i++) { cin >> op[i] >> left[i] >> right[i] >> height[i] ; } buildWall(n,k,op,left,right,height,finalHeight); for (int j = 0; j < n; j++) printf("%d\n", finalHeight[j]); return 0; }

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

/usr/bin/ld: /tmp/ccxJVFns.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cckJHT3q.o:wall.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status