Submission #368116

#TimeUsernameProblemLanguageResultExecution timeMemory
368116phathnvHop (COCI21_hop)C++11
110 / 110
44 ms1388 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int A = 64;
const int N = 1001;

int n, col[A][A], a[N];

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

    for(int i = 0; i < A; i++)
        for(int j = i + 1; j < A; j++)
            for(int k = 2; k >= 0; k--)
                if (j - i >= (1 << (2 * k))){
                    col[i][j] = k;
                    break;
                }

    cin >> n;
    for(int i = 1; i <= n; i++){
        ll x;
        cin >> x;
        a[i] = 63 - __builtin_clzll(x);
    }

    for(int j = 2; j <= n; j++){
        for(int i = 1; i < j; i++)
            cout << col[a[i]][a[j]] + 1 << ' ';
        cout << '\n';
    }

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