# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
537769 | jamezzz | Hop (COCI21_hop) | C++17 | 27 ms | 1288 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;
#define sf scanf
#define pf printf
typedef long long ll;
int n,pos[1005];
ll x[1005];
int main(){
sf("%d",&n);
for(int i=1;i<=n;++i)sf("%lld",&x[i]);
for(int i=1;i<=n;++i){
pos[i]=1;
for(int j=1;j<i;++j){
if(x[i]%x[j]==0)pos[i]=max(pos[i],pos[j]+1);
}
}
for(int i=2;i<=n;++i){
for(int j=1;j<i;++j){
if(x[i]%x[j]!=0){
pf("1 ");
continue;
}
if(pos[i]/4==pos[j]/4)pf("1 ");
else if(pos[i]/16==pos[j]/16)pf("2 ");
else pf("3 ");
}
pf("\n");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |