|
|
back to boardWrong AC Posted by DNS 12 Sep 2010 19:09 #include <iostream> using namespace std; int a[30000]; int m,answer,k=0; int ans(int x){ int amax=0; for(int i=x;i<x+m;i++) if (amax<a[i]) amax=a[i]; return amax; } int main(){ int n=0,N; cin>>m; for(int i=0;i<30000;i++){ cin>>n; if (n==-1)break; else {a[i]=n; N=i;} } for(int i=0;i<=N-m+1;i++) cout<<ans(i)<<endl; return 0; } bruteforce solution has ac. i think you should add some hard tests |
|
|