Submission #722344

# Submission time Handle Problem Language Result Execution time Memory
722344 2023-04-11T18:58:39 Z tvladm2009 List of Unique Integers (FXCUP4_unique) C++17
100 / 100
1 ms 468 KB
#include <bits/stdc++.h>
#include "unique.h"

using namespace std;

typedef long long ll;

const int N_MAX = 200;

int pref[N_MAX + 2], suff[N_MAX + 2];

vector <int> PickUnique(int N) {
    for (int i = 1; i <= N; i++) {
        pref[i] = UniqueCount(0, i - 1);
    }
    for (int i = N; i >= 1; i--) {
        suff[i] = UniqueCount(i - 1, N - 1);
    }
    vector <int> answer(N);
    for (int i = 1; i <= N; i++) {
        if (pref[i] == pref[i - 1] + 1 && suff[i] == suff[i + 1] + 1) {
            answer[i - 1] = 1;
        } else {
            answer[i - 1] = 0;
        }
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Correct : C = 4
2 Correct 0 ms 308 KB Correct : C = 10
3 Correct 1 ms 212 KB Correct : C = 50
4 Correct 1 ms 340 KB Correct : C = 100
5 Correct 1 ms 340 KB Correct : C = 100
6 Correct 1 ms 340 KB Correct : C = 154
7 Correct 1 ms 340 KB Correct : C = 200
8 Correct 1 ms 340 KB Correct : C = 300
9 Correct 1 ms 432 KB Correct : C = 356
10 Correct 1 ms 468 KB Correct : C = 400
11 Correct 1 ms 468 KB Correct : C = 400
12 Correct 1 ms 432 KB Correct : C = 400
13 Correct 0 ms 468 KB Correct : C = 400
14 Correct 1 ms 468 KB Correct : C = 400
15 Correct 0 ms 468 KB Correct : C = 400