Submission #89558

# Submission time Handle Problem Language Result Execution time Memory
89558 2018-12-15T18:07:30 Z sjhuang26 Global Warming (NOI13_gw) C++14
19 / 40
631 ms 32964 KB
#include<iostream>
#include<algorithm>
using namespace std;
typedef pair<int,int>ii;
int N,a[1000000],ch=0,ans=-1;
ii b[1000000];
//0=land,1=no land
bool f[1000000]={};
int main(){
  cin>>N;
  for(int i=0;i<N;++i){
    cin>>a[i];
    b[i]={a[i],i};
  }
  sort(b,b+N);
  if(b[0].first>0)ans=1;
  for(int i=0;i<N;++i){
    int x=b[i].second;
    if(x!=0)ch+=(f[x]==f[x-1]?1:-1);
    if(x!=N-1)ch+=(f[x]==f[x+1]?1:-1);
    f[x]=1;
    if((i==N-1)||(b[i].first!=b[i+1].first)){
      int isl;
      if(f[0]){
        //011223344...
        isl=ch/2+ch%2;
      }else{
        //112233445...
        isl=ch/2+1;
      }
      ans=max(ans,isl);
    }
  }
  cout<<ans<<'\n';return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 388 KB Output is correct
3 Correct 2 ms 472 KB Output is correct
4 Correct 3 ms 500 KB Output is correct
5 Correct 3 ms 592 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 2140 KB Output is correct
2 Correct 37 ms 2260 KB Output is correct
3 Correct 36 ms 2536 KB Output is correct
4 Correct 37 ms 2908 KB Output is correct
5 Correct 37 ms 3208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 56 ms 3460 KB Output is correct
2 Correct 43 ms 3460 KB Output is correct
3 Correct 56 ms 3460 KB Output is correct
4 Correct 62 ms 3460 KB Output is correct
5 Correct 58 ms 3460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 614 ms 14772 KB Output is correct
2 Correct 631 ms 14852 KB Output is correct
3 Correct 623 ms 14860 KB Output is correct
4 Correct 597 ms 24220 KB Output is correct
5 Runtime error 585 ms 32964 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
# Verdict Execution time Memory Grader output
1 Runtime error 608 ms 32964 KB Memory limit exceeded: We have a known bug that the memory usage is measured incorrectly (possibly because of Meltdown/Spectre patch), so your solution may be correct. Please submit again. Sorry for the inconvenience.
2 Halted 0 ms 0 KB -