# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
329732 | aris12345678 | Zoo (COCI19_zoo) | C++14 | 1 ms | 748 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 <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int, int>
#define fi first
#define se second
const int mxN = 1e4+5;
const int mod = 1e9+7;
const ll inf = 1e18;
int n, m, di[4] = {1, -1, 0, 0}, dj[4] = {0, 0, 1, -1};
string s[mxN];
bool vis[mxN][mxN];
bool is(int i, int j, char c) { return i >= 0 && j >= 0 && i < n && j < m && s[i][j] != '*' && s[i][j] == c && !vis[i][j]; }
void dfs(int i, int j, char c) {
vis[i][j] = 1;
for(int k = 0; k < 4; k++) {
for(int l = 0; l < 4; l++) {
if(is(di[k]+i, dj[l]+j, s[i][j])) dfs(di[k]+i, dj[l]+j, s[i][j]);
}
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cin >> n >> m;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |