답안 #148506

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148506 2019-09-01T04:34:11 Z 갓띵건(#3694, gs18103, sjimed, gs18065) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
6 ms 512 KB
#include "unique.h"
#include <bits/stdc++.h>
using namespace std;
int c1[405],c2[405],c[405];

vector<int> PickUnique(int n) {
    vector<int> v;
    c1[0]=1;
    for(int i=0;i<n;i++) c[i]=1;
    for(int i=1;i<n;i++){
        c1[i]=UniqueCount(0,i);
        if(c1[i-1]+1==c1[i]) continue;
        c[i]=0;
    }
    c2[n-1]=1;
    for(int i=n-2;i>=0;i--){
        c2[i]=UniqueCount(i,n-1);
        if(c2[i+1]+1==c2[i]) continue;
        c[i]=0;
    }
    for(int i=0;i<n;i++){
        v.push_back(c[i]);
    }
    return v;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 384 KB Correct : C = 2
2 Correct 5 ms 384 KB Correct : C = 8
3 Correct 5 ms 256 KB Correct : C = 48
4 Correct 6 ms 384 KB Correct : C = 98
5 Correct 5 ms 384 KB Correct : C = 98
6 Correct 6 ms 384 KB Correct : C = 152
7 Correct 6 ms 384 KB Correct : C = 198
8 Correct 5 ms 384 KB Correct : C = 298
9 Correct 6 ms 512 KB Correct : C = 354
10 Correct 6 ms 512 KB Correct : C = 398
11 Correct 5 ms 512 KB Correct : C = 398
12 Correct 6 ms 512 KB Correct : C = 398
13 Correct 5 ms 512 KB Correct : C = 398
14 Correct 6 ms 512 KB Correct : C = 398
15 Correct 6 ms 512 KB Correct : C = 398