답안 #232003

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
232003 2020-05-15T16:53:34 Z Blerargh List of Unique Integers (FXCUP4_unique) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "unique.h"
using namespace std;
 
vector<int> PickUnique(int N){
  vector<int> ans(N);
  int prevL=0, prevR=UniqueCounnt(0,N-1);
  for (int i=0; i<=N-1; i++){
    int newL = UniqueCount(0,i);
    if (i!=N-1) int newR = UniqueCount(i+1,N-1);
    if (newL == prevL+1 && newR == prevR+1) ans[i]=1;
    else ans[i] = 0;

    prevL = newL;
    prevR = newR;
  }
  return ans;
}

Compilation message

unique.cpp: In function 'std::vector<int> PickUnique(int)':
unique.cpp:7:22: error: 'UniqueCounnt' was not declared in this scope
   int prevL=0, prevR=UniqueCounnt(0,N-1);
                      ^~~~~~~~~~~~
unique.cpp:7:22: note: suggested alternative: 'UniqueCount'
   int prevL=0, prevR=UniqueCounnt(0,N-1);
                      ^~~~~~~~~~~~
                      UniqueCount
unique.cpp:10:21: warning: unused variable 'newR' [-Wunused-variable]
     if (i!=N-1) int newR = UniqueCount(i+1,N-1);
                     ^~~~
unique.cpp:11:28: error: 'newR' was not declared in this scope
     if (newL == prevL+1 && newR == prevR+1) ans[i]=1;
                            ^~~~
unique.cpp:11:28: note: suggested alternative: 'newL'
     if (newL == prevL+1 && newR == prevR+1) ans[i]=1;
                            ^~~~
                            newL
unique.cpp:15:13: error: 'newR' was not declared in this scope
     prevR = newR;
             ^~~~
unique.cpp:15:13: note: suggested alternative: 'newL'
     prevR = newR;
             ^~~~
             newL