Submission #1117100

# Submission time Handle Problem Language Result Execution time Memory
1117100 2024-11-22T20:15:58 Z gustavo_d Land of the Rainbow Gold (APIO17_rainbow) C++17
0 / 100
2 ms 764 KB
#include "rainbow.h"
#include <bits/stdc++.h>
using namespace std;

map<char, pair<int, int>> ds;

bool mark[51][51];

void init(int R, int C, int sr, int sc, int M, char *S) {
    ds['N'] = {-1, 0};
    ds['S'] = {1, 0};
    ds['E'] = {0, 1};
    ds['W'] = {0, -1};
    for (int i=0; i<=50; i++) mark[i][0] = true;
    for (int i=0; i<=50; i++) mark[0][i] = true;
    mark[sr][sc] = true;
    // cout << sr << ' ' << sc << endl;
    for (int i=0; i<M; i++) {
        char c = S[i];
        sr += ds[c].first;
        sc += ds[c].second;
        mark[sr][sc] = true;
        // cout << sr << ' ' << sc << endl;
    }
}

int colour(int ar, int ac, int br, int bc) {
    int cnt = 0;
    for (int r=ar; r<=br; r++) {
        for (int c=ac; c<=bc; c++) {
            if (!mark[r][c] and (mark[r][c-1] or c == ac) and (mark[r-1][c] or r == ar)) {
                cnt++;
                // cout << r << ' ' << c << endl;
            }
        }
    }
    return cnt;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Runtime error 1 ms 764 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Runtime error 2 ms 592 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -