| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 65267 | sean617 | JOI 문장 (JOI14_ho_t1) | C++98 | 2 ms | 376 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cstdio>
using namespace std;
int n, m, s, mx, d[1005][1005];
char a[1005][1005], b[2][2], c[3] = {'J', 'O', 'I'};
int f(int p, int q) {
return (a[p][q] == b[0][0] && a[p][q + 1] == b[0][1] && a[p + 1][q] == b[1][0] && a[p + 1][q + 1] == b[1][1]);
}
int main()
{
int i, j, k, z;
cin >> n >> m;
for (i= 1; i <= n; i++) {
scanf ("%s", &a[i][1]);
}
cin >> b[0] >> b[1];
for (i = 1; i < n; i++) {
for (j = 1; j < m; j++) {
z = f(i, j);
s += z;
d[i][j] = z;
}
}
mx = s;
for (i = 1; i <= n; i++) {
for (j = 1; j <= m; j++) {
for (k = 0; k < 3; k++) {
a[i][j] = c[k];
mx = max(mx, s - d[i - 1][j - 1] - d[i - 1][j] - d[i][j - 1] - d[i][j] + f(i - 1, j - 1) + f(i - 1, j) + f(i, j - 1) + f(i, j));
}
}
}
cout << mx;
return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
