This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define int long long
#define sz(a) (int)a.size()
#define ll long long
const int N = 1e5;
const int T = 20;
int color(int a, int b)
{
if((a / 4) == (b / 4))
{
return 1;
}
if((a / 16) == (b / 16))
{
return 2;
}
return 3;
}
signed main()
{
// ifstream cin("input1.txt.4c");
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
vector <int> x(n);
vector <int> x1(n);
for(int i = 0; i < n; i++)
{
cin >> x[i];
}
for(int i = 0; i < n; i++)
{
x1[i] = 63 - __builtin_clzll(x[i]);
}
for(int i = 0; i < n; i++)
{
for(int j = i + 1; j < n; j++)
{
if(x[j] % x[i] == 0)
{
cout << color(x1[i], x1[j]) << " ";
}
else
{
cout << 1 << " ";
}
}
cout << "\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |