답안 #125259

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
125259 2019-07-05T01:57:09 Z dragonslayerit Mountains (IOI17_mountains) C++14
20 / 100
1000 ms 380 KB
#include "mountains.h"
#include <vector>
#include <algorithm>
#include <cstdio>

int* base;

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::stable_sort(sub.begin(),sub.end(),[begin](int* a,int* b){return (a-begin)*(*b-*begin)>(b-begin)*(*a-*begin);});
  std::reverse(sub.begin(),sub.end());
  /*
    printf("[%ld,%ld):",begin-base,end-base);
  for(int* it:sub){
    printf("%ld",it-base);
  }
  printf("\n");
  */
  int* last=end;
  for(int* it:sub){
    if(it>last) continue;
    ans+=solve(it+1,last);
    last=it;
  }
  return std::max(ans,solve(begin+1,end));
}

int maximum_deevs(std::vector<int> y) {
  base=y.data();
  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 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 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 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 216 ms 356 KB Output is correct
18 Correct 476 ms 356 KB Output is correct
19 Correct 193 ms 376 KB Output is correct
20 Execution timed out 1000 ms 352 KB Time limit exceeded
21 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 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 216 ms 356 KB Output is correct
18 Correct 476 ms 356 KB Output is correct
19 Correct 193 ms 376 KB Output is correct
20 Execution timed out 1000 ms 352 KB Time limit exceeded
21 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 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 380 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 376 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 216 ms 356 KB Output is correct
18 Correct 476 ms 356 KB Output is correct
19 Correct 193 ms 376 KB Output is correct
20 Execution timed out 1000 ms 352 KB Time limit exceeded
21 Halted 0 ms 0 KB -