답안 #148372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148372 2019-09-01T04:12:06 Z 본인 하지만 안 어림 ㅋㅋ(#3569, gs13105, xdoju, gs13068) List of Unique Integers (FXCUP4_unique) C++17
35 / 100
6 ms 512 KB
#include "unique.h"
using namespace std;

vector<int> PickUnique(int N) {
  if(N == 1) return vector<int>(1, 1);

  vector<int> ans(N, 0);

  int total = UniqueCount(0, N - 1);

  for(int i = 0; i < N; i++){
    if(i == 0){
      int right = UniqueCount(1, N - 1);
      if(total > right) ans[0] = 1;
    }
    else if(i == N - 1){
      int left = UniqueCount(0, N - 2);
      if(total > left) ans[N - 1] = 1;
    }
    else{
      int leftExcept = UniqueCount(0, i - 1);
      int leftContain = UniqueCount(0, i);

      bool notInLeft = leftContain > leftExcept;

      int rightExcept = UniqueCount(i + 1, N - 1);
      int rightContain = UniqueCount(i, N - 1);

      bool notInRight = rightContain > rightExcept;

      if(notInLeft && notInRight) ans[i] = 1;
    }
  }

  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Correct : C = 3
2 Correct 5 ms 256 KB Correct : C = 15
3 Correct 5 ms 384 KB Correct : C = 95
4 Correct 5 ms 384 KB Correct : C = 195
5 Correct 5 ms 384 KB Correct : C = 195
6 Correct 6 ms 384 KB Correct : C = 303
7 Correct 5 ms 384 KB Correct : C = 395
8 Partially correct 5 ms 376 KB Partially correct : C = 595
9 Partially correct 5 ms 512 KB Partially correct : C = 707
10 Partially correct 6 ms 512 KB Partially correct : C = 795
11 Partially correct 6 ms 512 KB Partially correct : C = 795
12 Partially correct 6 ms 512 KB Partially correct : C = 795
13 Partially correct 6 ms 384 KB Partially correct : C = 795
14 Partially correct 6 ms 512 KB Partially correct : C = 795
15 Partially correct 6 ms 512 KB Partially correct : C = 795