답안 #125257

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
125257 2019-07-05T01:10:17 Z dragonslayerit Mountains (IOI17_mountains) C++14
0 / 100
2 ms 376 KB
#include "mountains.h"
#include <vector>
#include <algorithm>

int solve(int* begin,int* end){
  if(begin==end) return 0;
  int ans=1;
  std::vector<int*> sub;
  for(auto it=begin+1;it!=end;it++){
    sub.push_back(it);
  }
  std::sort(sub.begin(),sub.end(),[begin](int* a,int* b){return (a-begin)**b-(b-begin)**a;});
  int* last=begin;
  for(int* it:sub){
    if(it<last) continue;
    ans+=solve(last+1,it);
    last=it;
  }
  return std::max(ans,solve(begin+1,end));
}

int maximum_deevs(std::vector<int> y) {
  return solve(y.data(),y.data()+y.size());
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Incorrect 2 ms 256 KB Output isn't correct
6 Halted 0 ms 0 KB -