Submission #22329

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
223292017-04-30 03:57:42버거킹 송죽SK점 우수고객 (#40)Young Zebra (KRIII5_YZ)C++14
2 / 7
23 ms11596 KiB
#include<bits/stdc++.h>
using namespace std;
int n, m, org[405][405];
int par[160005], cnt[160005], inf[160005], cc;
char a[405][405];
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
vector<pair<pair<int,int>,int> > edg;
bool valid (int X, int Y) {
return (1<=X && X<=n && 1<=Y && Y<=m);
}
int Find (int X) {
if(par[X] == X) return X;
return par[X] = Find(par[X]);
}
int dfs (int X, int Y) {
org[X][Y] = cc;
int ret = 1;
for(int i=0;i<4;i++) {
int nx = X + dx[i], ny = Y + dy[i];
if(valid(nx, ny) && a[X][Y] == a[nx][ny] && !org[nx][ny]) {
ret += dfs(nx, ny);
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

YZ.cpp: In function 'int main()':
YZ.cpp:36: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:38:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%s",a[i]+1);
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...