YZ.cpp: In function 'void bfs(int, int)':
YZ.cpp:42:9: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
q.push({y,x});
^
YZ.cpp:42:14: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
q.push({y,x});
^
YZ.cpp:51:11: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
merge({y,x}, {ny,nx}), q.push({ny,nx}), visited[ny][nx] = 1;
^
YZ.cpp:51:18: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
merge({y,x}, {ny,nx}), q.push({ny,nx}), visited[ny][nx] = 1;
^
YZ.cpp:51:35: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
merge({y,x}, {ny,nx}), q.push({ny,nx}), visited[ny][nx] = 1;
^
YZ.cpp:51:42: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
merge({y,x}, {ny,nx}), q.push({ny,nx}), visited[ny][nx] = 1;
^
YZ.cpp: In function 'int main()':
YZ.cpp:58:64: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
for(int i=0;i<1222;i++) for(int j=0;j<1222;j++) p[i][j] = {i,j}, sz[i][j] = 1;
^
YZ.cpp:58:58: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
for(int i=0;i<1222;i++) for(int j=0;j<1222;j++) p[i][j] = {i,j}, sz[i][j] = 1;
^
YZ.cpp:77:31: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
pair<int, int> root = find({y,x});
^
YZ.cpp:59:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d",&n,&m);
^
YZ.cpp:60:41: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(int i=0;i<n;i++) scanf("%s",str[i]);
^