Submission #344788

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3447882021-01-06 14:43:43JovanK26Tracks in the Snow (BOI13_tracks)C++14
2.19 / 100
37 ms18668 KiB
#include <bits/stdc++.h>
using namespace std;
int n,m;
string mat[4001];
int co[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
vector<pair<int,int> > pt[2];
int rez=0;
bool check(int i,int j)
{
if(i<0 || i>=n || j<0 || j>=m || mat[i][j]=='.')return 0;
return 1;
}
void dfs(int i,int j)
{
char cur=mat[i][j];
mat[i][j]='.';
for(int i=0;i<4;i++)
{
int c1=i+co[i][0];
int c2=j+co[i][1];
if(!check(c1,c2))
{
continue;
}
if(mat[c1][c2]==cur)
{
dfs(c1,c2);
}
else
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

tracks.cpp: In function 'void dfs(int, int)':
tracks.cpp:32:19: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   32 |             pt[rez&1^1].push_back({c1,c2});
      |                ~~~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...