Submission #435025

# Submission time Handle Problem Language Result Execution time Memory
435025 2021-06-22T20:20:37 Z hossain2020 Land of the Rainbow Gold (APIO17_rainbow) C++14
11 / 100
3000 ms 545720 KB
#include "rainbow.h"
#include <bits/stdc++.h>
#include <map>
#include <iostream>
using namespace std;
map < pair <int,int > ,int > a,b;
int h=1,o=0,r,c;
void init(int R, int C, int sr, int sc, int m, char *s)
{
    r=R;
    c=C;
    a[{sc,sr}]=1;
    int x=sc,y=sr;
    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;
}

# Verdict Execution time Memory Grader output
1 Correct 28 ms 332 KB Output is correct
2 Correct 169 ms 536 KB Output is correct
3 Correct 374 ms 716 KB Output is correct
4 Correct 458 ms 824 KB Output is correct
5 Correct 144 ms 624 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 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 376 ms 836 KB Output is correct
12 Correct 306 ms 716 KB Output is correct
13 Correct 270 ms 640 KB Output is correct
14 Correct 279 ms 716 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
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Execution timed out 3070 ms 82748 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Execution timed out 3110 ms 545720 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 332 KB Output is correct
2 Correct 169 ms 536 KB Output is correct
3 Correct 374 ms 716 KB Output is correct
4 Correct 458 ms 824 KB Output is correct
5 Correct 144 ms 624 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 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 376 ms 836 KB Output is correct
12 Correct 306 ms 716 KB Output is correct
13 Correct 270 ms 640 KB Output is correct
14 Correct 279 ms 716 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 Execution timed out 3081 ms 67608 KB Time limit exceeded
19 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 28 ms 332 KB Output is correct
2 Correct 169 ms 536 KB Output is correct
3 Correct 374 ms 716 KB Output is correct
4 Correct 458 ms 824 KB Output is correct
5 Correct 144 ms 624 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 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 376 ms 836 KB Output is correct
12 Correct 306 ms 716 KB Output is correct
13 Correct 270 ms 640 KB Output is correct
14 Correct 279 ms 716 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 Execution timed out 3081 ms 67608 KB Time limit exceeded
19 Halted 0 ms 0 KB -