답안 #400704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
400704 2021-05-08T14:15:13 Z my99n 무지개나라 (APIO17_rainbow) C++14
11 / 100
18 ms 840 KB
#include "rainbow.h"
#include <bits/stdc++.h>
using namespace std;

int a[55][55], vis[55][55];
int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};

void ffill (int i, int j, int ar, int ac, int br, int bc) {
  if (a[i][j]) return;
  if (vis[i][j]) return;
  vis[i][j] = 1;
  // cerr << i << ' ' << j << endl;
  for (int d = 0; d < 4; d++) {
    int ni = i+dx[d], nj = j+dy[d];
    if (ni < ar or ni > br or nj < ac or nj > bc) continue;
    if (vis[ni][nj]) continue;
    if (a[ni][nj]) continue;
    ffill(ni, nj, ar, ac, br, bc);
  }
}

void init(int R, int C, int sr, int sc, int M, char *S) {
  a[sr][sc] = 1;
  for (int i = 0; i < M; i++) {
    if (S[i] == 'N') sr--;
    if (S[i] == 'S') sr++;
    if (S[i] == 'W') sc--;
    if (S[i] == 'E') sc++;
    a[sr][sc] = 1;
  }
  // for (int i = 1; i <= R; i++) {
  //   for (int j = 1; j <= C; j++) {
  //     cerr << a[i][j] << ' '; 
  //   } cerr << endl;
  // }
}

int colour(int ar, int ac, int br, int bc) {
  int cnt = 0;
  memset(vis, 0, sizeof vis);
  for (int i = ar; i <= br; i++) {
    for (int j = ac; j <= bc; j++) {
      if (vis[i][j]) continue;
      if (a[i][j]) continue;
      ffill(i, j, ar, ac, br, bc);
      // cerr << "fill " << ' ' << i << ' ' << j << endl;
      cnt++;
    }
  }
  return cnt;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 7 ms 332 KB Output is correct
3 Correct 18 ms 460 KB Output is correct
4 Correct 18 ms 460 KB Output is correct
5 Correct 7 ms 404 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 15 ms 460 KB Output is correct
12 Correct 13 ms 448 KB Output is correct
13 Correct 10 ms 424 KB Output is correct
14 Correct 6 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Runtime error 2 ms 716 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 2 ms 700 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 7 ms 332 KB Output is correct
3 Correct 18 ms 460 KB Output is correct
4 Correct 18 ms 460 KB Output is correct
5 Correct 7 ms 404 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 15 ms 460 KB Output is correct
12 Correct 13 ms 448 KB Output is correct
13 Correct 10 ms 424 KB Output is correct
14 Correct 6 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Runtime error 2 ms 840 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 7 ms 332 KB Output is correct
3 Correct 18 ms 460 KB Output is correct
4 Correct 18 ms 460 KB Output is correct
5 Correct 7 ms 404 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 15 ms 460 KB Output is correct
12 Correct 13 ms 448 KB Output is correct
13 Correct 10 ms 424 KB Output is correct
14 Correct 6 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Runtime error 2 ms 840 KB Execution killed with signal 11
19 Halted 0 ms 0 KB -