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

제출 #442692

#제출 시각아이디문제언어결과실행 시간메모리
442692Markomafko972Hop (COCI21_hop)C++14
110 / 110
57 ms5236 KiB
#include <bits/stdc++.h> using namespace std; int n; long long a[1005]; int kol[1005]; int sol[1005][1005]; vector< pair<int, int> > v; int main () { cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { sol[i][j] = 3; } } int z = -1; for (int i = 0; i < n; i++) { cin >> a[i]; int maxi = -1; for (int j = z+1; j < i; j++) { if (a[i] % a[j] == 0) { maxi = max(maxi, kol[j]); } } if (maxi >= 3) { v.push_back({z+1, i-1}); z = i-1; } else { for (int j = z+1; j < i; j++) sol[i][j] = 1; kol[i] = maxi+1; } //cout << i << ": " << kol[i] << endl; } v.push_back({z+1, n-1}); for (int i = 0; i < v.size(); i += 4) { for (int j = 0; j <= 3; j++) { for (int k = j+1; k <= 3; k++) { for (int l = v[i+j].first; l <= v[i+j].second; l++) { for (int m = v[i+k].first; m <= v[i+k].second; m++) { sol[m][l] = 2; } } } } } for (int i = 1; i < n; i++) { for (int j = 0; j < i; j++) { cout << sol[i][j] << " "; } cout << "\n"; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'int main()':
Main.cpp:44:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |  for (int i = 0; i < v.size(); i += 4) {
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...