| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 48707 | Extazy | Tracks in the Snow (BOI13_tracks) | C++17 | 2103 ms | 605464 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
const int N = 4007;
const pair < int, int > D[4] = {
  make_pair(1,0),
  make_pair(-1,0),
  make_pair(0,1),
  make_pair(0,-1)
};
int n,m;
char a[N][N];
bool used[N][N];
int ans;
void clear_used() {
  int i,j;
  for(i=1;i<=n;i++) {
    for(j=1;j<=m;j++) {
      used[i][j]=false;
    }
  }
}
void dfs(int r, int c, char ch) {
  a[r][c]='#';
  used[r][c]=true;
  int i,p,t;
  for(i=0;i<4;i++) {
    p=r+D[i].first;
    t=c+D[i].second;
    if(p>=1 && p<=n && t>=1 && t<=m) if(!used[p][t]) if(a[p][t]==ch || a[p][t]=='#') dfs(p,t,ch);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i,j;
  char curr;
  scanf("%d %d", &n, &m);
  for(i=1;i<=n;i++) {
    scanf("%s", a[i]+1);
  }
  curr=a[1][1];
  bool found=true;
  while(found) {
    found=false;
    for(i=1;i<=n;i++) {
      for(j=1;j<=m;j++) {
        if(a[i][j]==curr) {
          clear_used();
          dfs(i,j,a[i][j]);
          ++ans;
          if(curr=='R') curr='F';
          else curr='R';
          
          found=true;
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
