Sponsors

Tag: problem: (E) Choosing Carrot Solve In C/C++

Tinkoff Challenge – Final...

#include<iostream> #include<cstdio> #include<fstream> #include<algorithm> #include<vector> #include<map> #include<set> #include<queue> #include<cmath> #include<cstring> #include<cstdlib> using namespace std; int a,b; int main() { int n,i,x,y; cin>>n; for(i=1;i<=n;i=i+1) cin>>a; for(i=1;i<=n;i=i+1) { x=(i-1)-(n-i); if(x<0) x=-x; b=max(b,a); } for(i=1;i<n;i=i+1) { x=(i-1)-(n-i-1); if(x<0) x=-x; b=max(b,min(a,a)); } for(i=2;i<=n;i=i+1) b=max(b,b); for(i=1;i<n;i=i+1) cout<<b<<' '; cout<<b<<endl; return 0; }

Advertisement

spot_img