#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
//#define int ll
#define rep(i, l, n) for(int i = l; i < (n); ++i)
const char nl = '\n';
const int N = 1e3+10;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
ll n; cin >> n;
vector<ll> a(n+1), b(n+1);
rep(i, 1, n+1) {
cin >> a[i];
for (int j = 63; j >= 0; --j)
if ((1ll<<j)&a[i]){b[i] = j;break;}
}
int who[n+1][n+1];
memset(who, 0, sizeof who);
rep(i, 1, n+1)
rep(j, i+1, n+1) {
if (a[j]%a[i] == 0) {
//assert(b[j] != b[i]);
if (b[j]/4 == b[i]/4)who[i][j] = 0;
else if (b[j]/16 == b[i]/16)who[i][j] = 1;
else who[i][j] = 2;
}
}
rep(i, 2, n+1) {
rep(j, 1, i)cout << who[j][i]+1 << " ";
cout << nl;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |