답안 #983495

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
983495 2024-05-15T15:13:15 Z Abito 무지개나라 (APIO17_rainbow) C++17
11 / 100
3000 ms 4368 KB
#include "rainbow.h"
#include <bits/stdc++.h>
#define y1 YONE
using namespace std;
const int N=55;
int n,m,x1,y1,x2,y2;
bool a[N][N],vis[N][N];
bool ok(int x,int y){
    return x>=x1 && x<=x2 && y>=y1 && y<=y2 && !a[x][y] && !vis[x][y];
}
void dfs(int x,int y){
    vis[x][y]=1;
    if (ok(x+1,y)) dfs(x+1,y);
    if (ok(x,y+1)) dfs(x,y+1);
    if (ok(x-1,y)) dfs(x-1,y);
    if (ok(x,y-1)) dfs(x,y-1);
    return;
}
void init(int R, int C, int sr, int sc, int M, char *S) {
    n=R,m=C;
    a[sr][sc]=1;
    for (int i=0;i<M;i++){
        if (S[i]=='N') sr--;
        if (S[i]=='S') sr++;
        if (S[i]=='E') sc++;
        if (S[i]=='W') sc--;
        a[sr][sc]=1;
    }
}

int colour(int ar, int ac, int br, int bc) {
    x1=ar,x2=br;
    y1=ac,y2=bc;
    memset(vis,0,sizeof(vis));
    int ans=0;
    for (int i=x1;i<=x2;i++){
        for (int j=y1;j<=y2;j++){
            if (a[i][j] || vis[i][j]) continue;
            dfs(i,j);
            ans++;
        }
    }
    return ans;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 14 ms 344 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 440 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 440 KB Output is correct
11 Correct 11 ms 540 KB Output is correct
12 Correct 11 ms 612 KB Output is correct
13 Correct 7 ms 444 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Runtime error 4 ms 4368 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Runtime error 1 ms 604 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 14 ms 344 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 440 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 440 KB Output is correct
11 Correct 11 ms 540 KB Output is correct
12 Correct 11 ms 612 KB Output is correct
13 Correct 7 ms 444 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Execution timed out 3063 ms 2144 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 16 ms 344 KB Output is correct
4 Correct 14 ms 344 KB Output is correct
5 Correct 5 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 1 ms 440 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 440 KB Output is correct
11 Correct 11 ms 540 KB Output is correct
12 Correct 11 ms 612 KB Output is correct
13 Correct 7 ms 444 KB Output is correct
14 Correct 4 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Execution timed out 3063 ms 2144 KB Time limit exceeded
19 Halted 0 ms 0 KB -