| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1360114 | SulA | Grid Coloring (JOI25_ho_t1) | C++20 | 2097 ms | 26812 KiB |
#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
/*
* 2 1 1 2
* 1 1 1 2
* 2 2 2 2
* 1 2 2 2
*/
int main() {
int n; cin >> n;
int A[n+1], B[n+1];
for (int i = 0; i < n; cin >> A[i++]);
for (int i = 0; i < n; cin >> B[i++]);
map<int, long long> frq;
frq[A[0]]++;
for (int i = 1; i < n; i++) {
frq[A[i]]++, frq[B[i]]++;
}
for (int i = 1; i < n-1; i++) {
A[i + 1] = max(A[i], A[i + 1]);
B[i + 1] = max(B[i], B[i + 1]);
}
for (int i = 1; i < n; i++) {
for (int j = 1; j < n; j++) {
frq[max(A[i], B[j])] ++;
}
}
int mx = 0, col = 0;
for (auto [x, cnt] : frq) {
if (cnt >= mx) {
mx = cnt;
col = x;
}
}
cout << col << " " << mx;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
