(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 #464451

#TimeUsernameProblemLanguageResultExecution timeMemory
464451TheScrasseHop (COCI21_hop)C++14
110 / 110
46 ms1348 KiB
#include <bits/stdc++.h> using namespace std; #define nl "\n" #define nf endl #define ll long long #define pb push_back #define _ << ' ' << #define INF (ll)1e18 #define mod 998244353 #define maxn 1010 ll i, i1, j, k, k1, t, n, m, res, flag[10], a[maxn], b, dp[maxn], mt[maxn][maxn]; array<ll, 3> b4(ll x) { array<ll, 3> v; v[0] = x % 4; x /= 4; v[1] = x % 4; x /= 4; v[2] = x % 4; return v; } int main() { ios::sync_with_stdio(0); cin.tie(0); /* #if !ONLINE_JUDGE && !EVAL ifstream cin("input.txt"); ofstream cout("output.txt"); #endif */ cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; } for (i = 1; i <= n; i++) { for (j = 1; j < i; j++) { if (a[i] % a[j] == 0) dp[i] = max(dp[i], dp[j] + 1); } } for (i = 2; i <= n; i++) { for (j = 1; j <= i; j++) { if (a[i] % a[j] != 0) { cout << 1 << ' '; continue; } array<ll, 3> x = b4(dp[j]); array<ll, 3> y = b4(dp[i]); if (x[0] < y[0]) cout << 1 << ' '; else if (x[1] < y[1]) cout << 2 << ' '; else if (x[2] < y[2]) cout << 3 << ' '; } cout << nl; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...