답안 #435019

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
435019 2021-06-22T19:50:36 Z hossain2020 무지개나라 (APIO17_rainbow) C++14
0 / 100
71 ms 1100 KB
#include "rainbow.h"
#include <bits/stdc++.h>
int a[1005][200005],h=1,b[1005][200005],o=0,r,c;
void init(int R, int C, int sr, int sc, int m, char *s)
{
    r=R;
    c=C;
    a[sr][sc]=1;
    int x=sr,y=sc;
    b[x][y]=-1;
    for (int i=0;i<m;i++)
    {
        if (*s=='W')x--;
        else if (*s=='E')x++;
        else if (*s=='N')y--;
        else y++;
        a[x][y]=1;
        b[x][y]=-1;
        s++;
    }
}
void vis(int i,int j,int ar, int ac, int br, int bc)
{
    b[i][j]=h;
    if (b[i-1][j]!=h&&b[i-1][j]!=-1&&i-1>=ac)vis(i-1,j,ar,ac,br,bc);
    if (b[i][j-1]!=h&&b[i][j-1]!=-1&&j-1>=ar)vis(i,j-1,ar,ac,br,bc);
    if (b[i+1][j]!=h&&b[i+1][j]!=-1&&i+1<=bc)vis(i+1,j,ar,ac,br,bc);
    if (b[i][j+1]!=h&&b[i][j+1]!=-1&&j+1<=br)vis(i,j+1,ar,ac,br,bc);
}
int f(int i,int j,int ar, int ac, int br, int bc)
{
    if (b[i][j]==h||b[i][j]==-1)
    {
        return 0;
    }
    vis(i,j,ar,ac,br,bc);
    return 1;
}
int colour(int ar, int ac, int br, int bc)
{
    o=0;
    for (int i=ac;i<=bc;i++)
    {
        for (int j=ar;j<=br;j++)
        {
            o+=f(i,j,ar,ac,br,bc);
        }
    }
    h++;
    return o;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 7 ms 916 KB Output is correct
3 Correct 19 ms 1100 KB Output is correct
4 Correct 19 ms 1084 KB Output is correct
5 Runtime error 38 ms 844 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Runtime error 71 ms 460 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 7 ms 916 KB Output is correct
3 Correct 19 ms 1100 KB Output is correct
4 Correct 19 ms 1084 KB Output is correct
5 Runtime error 38 ms 844 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 7 ms 916 KB Output is correct
3 Correct 19 ms 1100 KB Output is correct
4 Correct 19 ms 1084 KB Output is correct
5 Runtime error 38 ms 844 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -