제출 #289140

#제출 시각아이디문제언어결과실행 시간메모리
289140stoyan_malininWall (IOI14_wall)C++14
8 / 100
3088 ms14004 KiB
#include "wall.h" //#include "grader.cpp" #include <vector> #include <iostream> const int MAXN = 1e5 + 5; struct Range { int l, r; Range(){} Range(int l, int r) { this->l = l; this->r = r; } int f(int x) { if(x<=l) return l; if(x>=r) return r; return x; } }; Range Merge(Range first, Range second) { if(second.l>=first.r) return Range(second.l, second.l); if(second.r<=first.l) return Range(second.r, second.r); if(second.l<=first.l && first.r<=second.r) return Range(first.l, first.r); if(first.l<=second.l && second.r<=first.r) return Range(second.l, second.r); if(first.l<=second.l && first.r<=second.r && second.l<=first.r) return Range(second.l, first.r); if(second.l<=first.l && second.r<=first.r && first.l<=second.r) return Range(first.l, second.r); } void buildWall(int n, int k, int op[], int left[], int right[], int height[], int finalHeight[]) { for(int ind = 0;ind<n;ind++) { Range ans = Range(0, MAXN); for(int i = 0;i<k;i++) { if(ind<left[i] || ind>right[i]) continue; if(op[i]==1) ans = Merge(ans, Range(height[i], MAXN)); else ans = Merge(ans, Range(0, height[i])); } finalHeight[ind] = ans.f(0); } }

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

wall.cpp: In function 'Range Merge(Range, Range)':
wall.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...