| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 19245 | 季洁 | 房屋积水 | C++ | Wrong Answer | 0 | 0 MS | 256 KB | 381 | 2021-05-12 19:21:48 |
#include<bits/stdc++.h> using namespace std; int l,h[1001],sum,i,j; int main(){ cin>>l; for(i=1;i<=l;i++) cin>>h[i]; int lmax=h[0],rmax=h[l-1]; i=1; j=l; while(i<j){ if(lmax<rmax){ i++; if(h[i]>lmax) lmax=h[i]; else sum+=lmax-h[i]; } else{ j--; if(h[j]>rmax) rmax=h[j]; else sum+=rmax-h[j]; } } cout<<sum<<endl; return 0; }