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

제출 #474647

#제출 시각아이디문제언어결과실행 시간메모리
474647mychecksedadHop (COCI21_hop)C++17
110 / 110
50 ms1316 KiB
#include<bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define all(x) x.begin(), x.end() const int N = 1e3+10; int n; ll arr[N], ans[N]; int main(){ cin.tie(0); ios::sync_with_stdio(0); cin >> n; for(int i = 1; i <= n; i++) cin >> arr[i]; for(int i = 2; i <= n; i++){ vector<int> x(3); for(int j = 1; j < i; j++){ if(arr[i] % arr[j] == 0){ x[ans[j]]++; } } int mn = min_element(all(x)) - x.begin(); ans[i] = mn; } for(int i = 2; i <= n; i++){for(int j = 1; j < i; j++) cout << ans[j] + 1 << ' '; cout << '\n';} return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...