(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #418814

#제출 시각아이디문제언어결과실행 시간메모리
418814ChaskaHop (COCI21_hop)C++11
110 / 110
57 ms8160 KiB
#include <bits/stdc++.h> #define ll long long using namespace std; const int N =1005; ll n,a[N],dp[N][4],col[N][N]; int main() { cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0); cin >> n; for (int i=0;i<n;i++) cin >> a[i]; for (int i=n-2;i>=0;i--) { for (int j=i+1;j<n;j++) { if (a[j]%a[i] == 0) { ll x,y,z; x = dp[j][1]+1; y = dp[j][2]+1; z = dp[j][3]+1; if (x<=3) { col[i][j] =1; dp[i][1] = max(dp[i][1],x); } else { if (y<=3) { col[i][j] = 2; dp[i][2] = max(dp[i][2],y); } else { col[i][j] = 3; dp[i][3] = max(dp[i][3],z); } } } else { col[i][j] = 1; } } } for (int i=1;i<n;i++) { for (int j=0;j<i;j++) { cout << col[j][i] << " "; } cout << "\n"; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...