Submission #1133256

#TimeUsernameProblemLanguageResultExecution timeMemory
1133256WendidiaskList of Unique Integers (FXCUP4_unique)C++20
0 / 100
0 ms320 KiB
/*
                                     :---:--:--::::::--:-:----:                                     
                               ::-:::.                         ::-:::                               
                       .*  -===..                                    :---                           
                     .-+*##=-------====-:                                :--:                       
                  :+##=.* -=            :=+-                                .-=:                    
               .+++-.  :-   -=.            .=+-                                .--.                 
             .++=-     +      -=              :*-                                 :-.               
            +*+-      :-        -=.             -*:                                 :=:             
           #*:        *           -=.             +-                                  .=            
        =:%+         -:             -=.            +-                                   --          
        -%:          *                -=.           *:                                    +.        
       :%-..        =.                  -=.          #                                     -:       
      :=#   ..      +                     -=.        ==                                     -=      
     ---+     .    =                        -=.      .#                                      .+     
    -: ==       .  =         :------::------:.-=.     %                                       .=    
   :-  ==        .=.     ---:.               :--#+.  .%                                        :-   
   =   .*        .+.. :=-                        :++ -+                                         =:  
  +     #.       +  -=:                            :*%-*:                                        *  
 :=     :#      :=:=   .                    :-----: =+-+                                         .+ 
 *       -*     *=-     . .-        :::::::.       :*  .#+.                                       + 
:-        -+   :#.        --::-----:              :*     ++=                                      .-
+          :*. *.    .:::::*%:                   ++       +.-=.                                    +
+           -#**----:       .=                 -*.         +  -=                                   =
*           +.#=+:           +  .           .=+:           =.   -=.                                =
=            -+  :++:         +   ..     .=+=              .=     -=.                              -
=            %-     :====-:.  =.  .:--===-                  *       -=.                            -
+           +--          .:--==#==-:.=                      +         -=.                          =
*           + *                =.    :                     .=           -=.                        =
+          =  *                 +                          =              -=.                      +
:-         =  .=                =:                         =                -=.                   .-
 *        +    =:                *                        *                   -=.                 + 
 :-      .+     =-               :-                     .+                      -=.              .+ 
  *      *       :=               *                    :=                         -=             *  
   =    :-         =:             .-                 .=:                            -=.         =:  
   -:   *           .=-            +               .=-                                -=       :-   
    =: -:              --:         :-           :--:                                    -=.   .=    
     =:+                  ----.     *       :---.                                         -= .+     
    --=*----------------------=*+=--=+--=+*+------------------------------------------------%+:.    
    :: :=                           +:-                                                    -- :.    
        .=.                                                                               =.        
          -=                                                                            -=          
           .=:                                                                        .=.           
             .=:                                                                    .+:             
               :--                                                                :-:               
                  --                                                            -=.                 
                    :--.                                                     --:                    
                       :--:                                              .--:                       
                          .-:-:                                      ::--.                          
                               :----.                          .:----                               
                                    .:::::::::-::::::--::::::::.                             
 */
 // Hello this is Tyx2019's clone
#include "unique.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define debug(x) cerr << #x << " is " << x << "\n"
#define hehe ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(i, a, b) for (int i = a; i <= b; i++)
#define repb(i, a, b) for (int i = b; i >= a; i--)
#define pii pair<int, int>
#define linebreak cout << "---------------------------------------------------------\n"
#define f first
#define s second
#define pb push_back
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
// good luck
const int MS = 2e5+5, mod = 1e9+9, INF = INT_MAX, blk = 400;

/*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];
}*/

vector<int> PickUnique(int n) {
	int pref[n], suff[n];
	for (int i = 0; i < n; i++) {
		pref[i] = UniqueCount(0, i);
		suff[i] = UniqueCount(i, n-1);
	}	
	vector<int> ans;
	for (int i = 0; i < n; i++) {
		int ok = 1;
		if (i != 0 and pref[i] <= pref[i-1]) ok = 0;
		if (i != n-1 and suff[i] <= suff[i+1]) ok = 0;
		ans.pb(ok);
	}
	for (auto it : ans) cout << it << " ";
	cout << '\n';
	return ans;
}
/*
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 timeMemoryGrader output
Fetching results...