# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48452 | Pajaraja | Tracks in the Snow (BOI13_tracks) | C++17 | 1879 ms | 685748 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;
int t[4007][4007],vi[4007][4007],n,m;
queue<pair<int,int> > q[3];
void dfs(int x,int y,int k)
{
if(x<0 || y<0 || x>=n || y>=m || vi[x][y]) return;
if(t[x][y]!=k)
{
if(t[x][y]==3-k) q[3-k].push(make_pair(x,y));
return;
}
vi[x][y]=true;
dfs(x-1,y,k);
dfs(x+1,y,k);
dfs(x,y-1,k);
dfs(x,y+1,k);
}
int main()
{
int sol=0;
cin>>n>>m;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
for(int j=0;j<m;j++) t[i][j]=(s[j]=='F'?2:(s[j]=='R'?1:0));
}
q[t[0][0]].push(make_pair(0,0));
for(int i=0;i<16000000;i++)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |