# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786025 | yeyso | Mars (APIO22_mars) | C++17 | 1 ms | 288 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 "mars.h"
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> m;
vector<vector<int>> v;
void dfs(int i, int j, int z){
if(!v[i][j] and m[i][j] != 0){
v[i][j] = z;
if(i < 5) dfs(i+1, j, z);
if(j < 5) dfs(i, j+1, z);
}
}
string process(vector<vector<string>> a, int i, int j, int k, int n)
{
if(k == 0){
string z(100, '0');
int x = 0;
for(int i = 0; i < 3; i ++){
for(int j = 0; j < 3; j ++){
z[x] = a[i][j][0];
x += 1;
}
}
return z;
}
if(k == 1){
vector<vector<int>> grid(5, vector<int>(5, 0));
v = grid;
int x = 0;
for(int i = 0; i < 3; i ++){
for(int j = 0; j < 3; j ++){
grid[i][j] = a[0][0][x]; x += 1;
}
} x = 0;
for(int i = 0; i < 3; i ++){
for(int j = 3; j < 6; j ++){
grid[i][j] = a[0][2][x]; x += 1;
}
} x = 0;
for(int i = 3; i < 6; i ++){
for(int j = 0; j < 3; j ++){
grid[i][j] = a[2][0][x]; x += 1;
}
} x = 0;
for(int i = 3; i < 6; i ++){
for(int j = 3; j < 6; j ++){
grid[i][j] = a[2][2][x]; x += 1;
}
}
m = grid;
x = 1;
for(int i = 0; i < grid.size(); i ++){
for(int j = 0; j < grid[i].size(); j ++){
dfs(i, j, x);
x += 1;
}
}
set<int> is;
for(int i = 0; i < v.size(); i ++){
for(int j = 0; j < v[i].size(); j ++){
is.insert(v[i][j]);
}
}
string res = bitset<100>(is.size() - 1).to_string();
return res;
}
return std::string(100 ,'0');
}
/*
*/
Compilation message (stderr)
# | 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... |