답안 #89556

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
89556 2018-12-15T18:04:51 Z sjhuang26 지구 온난화 (NOI13_gw) C++14
19 / 40
621 ms 33792 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 520 KB Output is correct
3 Correct 2 ms 528 KB Output is correct
4 Correct 2 ms 552 KB Output is correct
5 Correct 2 ms 624 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 37 ms 2248 KB Output is correct
2 Correct 34 ms 2492 KB Output is correct
3 Correct 34 ms 2744 KB Output is correct
4 Correct 35 ms 3000 KB Output is correct
5 Correct 36 ms 3252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 56 ms 4344 KB Output is correct
2 Correct 43 ms 4856 KB Output is correct
3 Correct 56 ms 5876 KB Output is correct
4 Correct 55 ms 6532 KB Output is correct
5 Correct 53 ms 7432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 602 ms 28248 KB Output is correct
2 Runtime error 621 ms 33792 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.
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 584 ms 33792 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 -