diff --git a/13lanqiao/test4-1.cpp b/13lanqiao/test4-1.cpp new file mode 100644 index 0000000..2f565cc --- /dev/null +++ b/13lanqiao/test4-1.cpp @@ -0,0 +1,37 @@ +// lanqiao 2107 修剪灌木(模拟法) +#include +using namespace std; +const int N = 1e4 + 10; +int mxh[N]; +int main(){ + int n; cin >> n; + vector h(n); + for(int d = 1; d <= n; d++){ + for(int i = 0; i < h.size(); i++){ + h[i] += 1; + h[d-1] = 0; + mxh[i] = max(mxh[i], h[i]); + } + } + for(int d = n; d >= 1; d--){ + for(int i = 0; i < h.size(); i++){ + h[i] += 1; + h[d-1] = 0; + mxh[i] = max(mxh[i], h[i]); + } + } + for(int d = 1; d <= n; d++){ + for(int i = 0; i < h.size(); i++){ + h[i] += 1; + h[d-1] = 0; + mxh[i] = max(mxh[i], h[i]); + } + } + for(int i = 0; i < h.size(); i++){ + cout << mxh[i] << endl; + } + return 0; +} +/* test samples -> 4 2 4 +3 +*/ \ No newline at end of file