# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
538333 | dantoh000 | Hop (COCI21_hop) | C++14 | 51 ms | 5324 KiB |
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;
int n;
long long a[1005];
int c[4][4];
int ans[1005][1005];
vector<int> G[4][1005];
int d[4][1005];
int X[1005];
int main(){
scanf("%d",&n);
for (int i = 0; i < n; i++){
scanf("%lld",&a[i]);
X[i] = 63-__builtin_clzll(a[i]);
//printf("%d ",X[i]);
}
//printf("\n");
for (int i = 0; i < n; i++){
for (int j = 0; j < i; j++){
//printf("final %d %d\n",x,y);
if ((X[i]>>2ll) == (X[j]>>2ll)) ans[i][j] = 1;
else if ((X[i]>>4ll) == (X[j]>>4ll)) ans[i][j] = 2;
else ans[i][j] = 3;
}
}
/*
for (int i = 0; i < n; i++){
for (int j = 0; j < i; j++){
//printf("col %d %d->%d\n",ans[i][j],j,i);
if (a[i]%a[j] == 0) G[ans[i][j]][i].push_back(j);
}
}
memset(d,0,sizeof(d));
int maxd = 0;
for (int i = 1; i <= 3; i++){
for (int j = 0; j < n; j++){
for (auto k : G[i][j]){
d[i][j] = max(d[i][j], d[i][k]+1);
}
}
}
for (int i = 1; i <= 3; i++){
for (int j = 0; j < n; j++){
maxd = max(maxd, d[i][j]);
printf("%d ",d[i][j]);
}
printf("\n");
}
printf("%d ",maxd);
*/
for (int i = 0; i < n; i++){
for (int j = 0; j < i; j++){
printf("%d ",ans[i][j]);
}
printf("\n");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |