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 "mars.h"
#include<bits/stdc++.h>
using namespace std;
string process(vector<vector<string>> a, int x, int y, int k, int n) {
string res(100, '0');
if (n == 1) {
char t[3][3];
int r = 0;
int used[3][3];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
t[i][j] = a[i][j][0];
used[i][j] = 0;
}
}
for (int i = 0; i <= 2 * n; i++) {
for (int j = 0; j <= 2 * n; j++) {
if (t[i][j] == '1' && !used[i][j]) {
r++;
used[i][j] = 1;
for (int i1 = 0; i1 <= 2 * n; i1++) {
for (int j1 = 0; j1 <= 2 * n; j1++) {
if (t[i1][j1] == '0')
continue;
if (i1 > 0)
used[i1][j1] = max(used[i1][j1], used[i1 - 1][j1]);
if (j1 > 0)
used[i1][j1] = max(used[i1][j1], used[i1][j1 - 1]);
}
}
}
}
}
// cout << r << "\n";
for (int i = 0; i <= 10; i++) {
if (r & (1 << i))
res[i] = '1';
}
return res;
}
if (k == 0) {
for (int i1 = 0; i1 < 3; i1++) {
for (int j1 = 0; j1 < 3; j1++) {
int i = x + i1, j = y + j1;
res[2 * n * i + j] = max(res[2 * n * i + j], a[i1][j1][0]);
}
}
return res;
}
if (k != n - 1) {
for (int i = 0; i <= 2 * n; i++) {
for (int j = 0; j <= 2 * n; j++) {
if (i < x || j < y) {
continue;
}
for (int i1 = 0; i1 < 3; i1++) {
for (int j1 = 0; j1 < 3; j1++) {
res[2 * n * i + j] = max(res[2 * n * i + j], a[i1][j1][2 * n * i + j]);
}
}
}
}
return res;
}
char t[2 * n + 1][2 * n + 1];
int r = 0;
int used[2 * n + 1][2 * n + 1];
for (int i = 0; i <= 2 * n; i++) {
for (int j = 0; j <= 2 * n; j++) {
t[i][j] = '0';
used[i][j] = 0;
}
}
for (int i = 0; i <= 2 * n; i++) {
for (int j = 0; j <= 2 * n; j++) {
for (int i1 = 0; i1 < 3; i1++) {
for (int j1 = 0; j1 < 3; j1++) {
t[i][j] = max(t[i][j], a[i1][j1][2 * n * i + j]);
}
}
}
}
for (int i = 0; i <= 2 * n; i++) {
for (int j = 0; j <= 2 * n; j++) {
if (t[i][j] == '1' && !used[i][j]) {
r++;
used[i][j] = 1;
for (int i1 = 0; i1 <= 2 * n; i1++) {
for (int j1 = 0; j1 <= 2 * n; j1++) {
if (t[i1][j1] == '0')
continue;
if (i1 > 0)
used[i1][j1] = max(used[i1][j1], used[i1 - 1][j1]);
if (j1 > 0)
used[i1][j1] = max(used[i1][j1], used[i1][j1 - 1]);
}
}
}
}
}
for (int i = 0; i <= 10; i++) {
if (r & (1 << i))
res[i] = '1';
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |