# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148446 | rkm0959 (#200) | List of Unique Integers (FXCUP4_unique) | C++17 | 6 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define L long long
using namespace std;
int UniqueCount(int l,int r);
int n;
vector<int> PickUnique(int N){
vector<int>ret(N,1);
n=N;
int i;
int now=1;
for(i=1;i<N;i++)
{
int temp=UniqueCount(0,i);
//printf("%d ",temp);
if(temp<=now) ret[i]=0;
now=temp;
}
//puts("");
now=1;
for(i=N-2;i>=0;i--)
{
int temp=UniqueCount(i,n-1);
//printf("%d ",temp);
if(temp<=now) ret[i]=0;
now=temp;
}
//puts("");
/*for(i=0;i<n;i++)
printf("%d ",ret[i]);*/
return ret;
}
/*
#include <stdio.h>
#include <stdlib.h>
#include "unique.h"
static int N, arr[222], unq[222][222], chk[222];
static void my_assert(int TF, const char* message){
if(!TF){ puts(message); exit(0); }
}
static int call_cnt = 0;
int UniqueCount(int R, int C){
call_cnt++;
my_assert(call_cnt <= 40000, "Wrong : Too Much Calls");
my_assert(R >= 0 && C < N && R <= C, "Wrong : Invalid R, C");
return unq[R][C];
}
int main(){
my_assert(scanf("%d", &N) == 1, "Error: Invalid Input");
my_assert(2 <= N && N <= 200, "Error: Invalid Input");
for(int i = 0; i < N; i++){
my_assert(scanf("%d", &arr[i]) == 1, "Error: Invalid Input");
my_assert(1 <= arr[i] && arr[i] <= 200, "Error: Invalid Input");
}
for(int i = 0; i < N; i++){
int u = 0;
for(int j = 1; j <= 200; j++) chk[j] = 0;
for(int j = i; j < N; j++){
chk[arr[j]]++;
if(chk[arr[j]] == 1) u++;
if(chk[arr[j]] == 2) u--;
unq[i][j] = u;
}
}
for(int i = 1; i <= 200; i++) chk[i] = 0;
for(int i = 0; i < N; i++) chk[arr[i]]++;
std::vector<int> rpd = PickUnique(N);
my_assert((int) rpd.size() == N, "Wrong: Wrong Answer");
for(int i = 0; i < N; i++){
my_assert(rpd[i] == 0 || rpd[i] == 1, "Wrong: Wrong Answer");
if(chk[arr[i]] == 1) my_assert(rpd[i], "Wrong : Wrong Answer");
if(rpd[i]) my_assert(chk[arr[i]] == 1, "Wrong : Wrong Answer");
}
printf("Correct\n%d\n", call_cnt);
return 0;
}
*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |