From 32625a7d0ea29e81e64b242cf22ef16fe9f27cf9 Mon Sep 17 00:00:00 2001 From: xingyou wu <3050128610@qq.com> Date: Sat, 29 Mar 2025 19:39:27 +0800 Subject: [PATCH] =?UTF-8?q?//=20lanqiao=202107=20=E4=BF=AE=E5=89=AA?= =?UTF-8?q?=E7=81=8C=E6=9C=A8(=E6=A8=A1=E6=8B=9F=E6=B3=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 13lanqiao/test4-1.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 13lanqiao/test4-1.cpp 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