Submission #150962

# Submission time Handle Problem Language Result Execution time Memory
150962 2019-09-01T13:11:17 Z computerbox List of Unique Integers (FXCUP4_unique) C++17
100 / 100
2 ms 504 KB
#include "unique.h"

#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll preff[210];
ll suff[210];

vector<int> PickUnique(int N) {
	vector<int>ans;
    for(ll i=0;i<N;i++)
    {
      preff[i]=UniqueCount(i,N-1);
    }
    for(ll i=0;i<N;i++)
    {
      suff[i]=UniqueCount(0,i);
    }

    for(int i=0;i<N;i++)
    {
       ll sig=0;
       ll sigg=0;
       if(i==0)
       {
        ll cntR=preff[i];
        ll cntR1=preff[i+1];
        if(cntR1<cntR)sig=1;
        if(sig)ans.push_back(1);
        else ans.push_back(0);
       }
       else if(i==N-1)
       {
        ll cntL=suff[i];
        ll cntL1=suff[i-1];
        if(cntL1<cntL)sigg=1;
        if(sigg)ans.push_back(1);
        else ans.push_back(0);
       }
       else
       {
        ll cntR=preff[i];
        ll cntR1=preff[i+1];
        if(cntR1<cntR)sig=1;
        ll cntL=suff[i];
        ll cntL1=suff[i-1];
        if(cntL1<cntL)sigg=1;
        if(sigg && sig)ans.push_back(1);
        else ans.push_back(0);
       }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Correct : C = 4
2 Correct 2 ms 376 KB Correct : C = 10
3 Correct 2 ms 376 KB Correct : C = 50
4 Correct 2 ms 252 KB Correct : C = 100
5 Correct 2 ms 376 KB Correct : C = 100
6 Correct 2 ms 376 KB Correct : C = 154
7 Correct 2 ms 376 KB Correct : C = 200
8 Correct 2 ms 376 KB Correct : C = 300
9 Correct 2 ms 376 KB Correct : C = 356
10 Correct 2 ms 504 KB Correct : C = 400
11 Correct 2 ms 376 KB Correct : C = 400
12 Correct 2 ms 504 KB Correct : C = 400
13 Correct 2 ms 376 KB Correct : C = 400
14 Correct 2 ms 504 KB Correct : C = 400
15 Correct 2 ms 376 KB Correct : C = 400