(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.

Submission #541536

#TimeUsernameProblemLanguageResultExecution timeMemory
541536AlperenTHop (COCI21_hop)C++17
0 / 110
1 ms468 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1000 + 5; int n, arr[N], ans[N][N], dist[N]; int main(){ ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> n; for(int i = 1; i <= n; i++) cin >> arr[i]; for(int i = 1; i <= n; i++){ for(int j = i + 1; j <= n; j++){ if(arr[j] % arr[i] == 0){ dist[j] = max(dist[j], dist[i] + 1); } else ans[i][j] = 3; } } for(int i = 1; i <= n; i++){ for(int j = i + 1; j <= n; j++){ if(ans[i][j] == 0){ if(dist[i] / 4 == dist[j] / 4) ans[i][j] = 1; else if(dist[i] / 16 == dist[j] / 16) ans[i][j] = 2; else ans[i][j] = 3; } } } for(int i = 2; i <= n; i++){ for(int j = 1; j < i; j++){ cout << ans[j][i] << " "; } cout << "\n"; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...