Submission #929113

#TimeUsernameProblemLanguageResultExecution timeMemory
929113a_l_i_r_e_z_aHop (COCI21_hop)C++17
110 / 110
27 ms1372 KiB
// In the name of God
// Hope is last to die

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
// #define int long long    
#define S second
#define F first
#define mp make_pair
#define smax(x, y) (x) = max((x), (y))
#define smin(x, y) (x) = min((x), (y))
#define all(x) (x).begin(), (x).end()
#define len(x) ((int)(x).size())

const int maxn = 1000 + 5;
const int inf = 1e9 + 7;
ll n, a[maxn];

int32_t main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    cin >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 1; i < n; i++){
        ll b = 63 - __builtin_clzll(a[i]);
        for(int j = 0; j < i; j++){
            ll x = 63 - __builtin_clzll(a[j]);
            if((b / 4) == (x / 4)) cout << 1 << ' ';
            else if((b / 16) == (x / 16)) cout << 2 << ' ';
            else cout << 3 << ' ';
        }
        cout << '\n';
    }

    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...