# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
126166 | choikiwon | Sandwich (JOI16_sandwich) | C++17 | 3679 ms | 7032 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;
typedef long long ll;
typedef pair<int, int> pii;
const int MN = 444;
int N, M;
char G[MN][MN];
int vis[MN][MN];
int ans[MN][MN];
int cnt;
void dfs(int r, int c, int t) {
if(vis[r][c] == 2) return;
if(vis[r][c] == 1) {
cnt = 1e9;
return;
}
vis[r][c] = 1;
cnt++;
if(t) {
if(G[r][c] == 'N') {
if(r) dfs(r - 1, c, 1);
if(c + 1 < M) dfs(r, c + 1, G[r][c + 1] == 'N');
}
else {
if(r) dfs(r - 1, c, 1);
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |