# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105716 | Pro_ktmr | Sandwich (JOI16_sandwich) | C++14 | 2070 ms | 15496 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 REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define PB push_back
#define MP make_pair
#define all(x) x.begin(),x.end()
int H,W;
string S[400];
int state[400][400]; //0:初期、1:計算中、2:計算終了
/*
3
1 2
0
*/
int dfs(int y, int x, int d){
if(x < 0 || x >= W || y < 0 || y >= H) return 0;
if(state[y][x] == 1) return INT_MAX;
if(state[y][x] == 2) return 0;
state[y][x] = 1;
int ans = 1;
if(S[y][x] == 'N'){
if(d == 0 || d == 1){
int tmp = dfs(y, x+1, 1);
if(tmp == INT_MAX) return INT_MAX;
ans += tmp;
tmp = dfs(y-1, x, 0);
if(tmp == INT_MAX) return INT_MAX;
ans += tmp;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |