Two Out of Three Solution codeforces
B. Two Out of Three time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output You are given an array a1,a2,…,an�1,�2,…,��. You need to find an array b1,b2,…,bn�1,�2,…,�� consisting of numbers 11, 22, 33 such that exactly two out of the following three conditions are satisfied: There exist indices 1≤i,j≤n1≤�,�≤� such that ai=aj��=��, bi=1��=1, bj=2��=2. There exist indices 1≤i,j≤n1≤�,�≤� such that ai=aj��=��, bi=1��=1, bj=3��=3. There exist … Read more