Submission #262893

# Submission time Handle Problem Language Result Execution time Memory
262893 2020-08-13T10:36:26 Z srvlt Land of the Rainbow Gold (APIO17_rainbow) C++14
0 / 100
4 ms 3840 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define all(x) begin(x), end(x)
#define SZ(x) (int)(x).size()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#include "rainbow.h"

const int n0 = 2e5 + 123;
int n, r, c, a[3][n0], s[3][n0], num[3][n0];

void init(int R, int C, int sr, int sc, int M, char *S) {
	r = R, c = C;
	for (int i = 1; i <= r; i++)
		for (int j = 1; j <= c; j++)
			a[i][j] = 1;
	int x = sr, y = sc;
	a[x][y] = 0;
	for (int i = 0; i < M; i++) {
		if (S[i] == 'N') x--;
		if (S[i] == 'S') x++;
		if (S[i] == 'W') y--;
		if (S[i] == 'E') y++;
		a[x][y] = 0;
	}
	for (int i = 1; i < r; i++) {
		for (int j = 1; j < c; j++) {
			if ((a[i][j] && a[i + 1][j]) || (a[i][j + 1] && a[i + 1][j + 1]))
				s[i][j] = 1;
			s[i][j] += s[i][j - 1];
		}
	}
	for (int i = 1; i <= r; i++)
		for (int j = 1; j <= c; j++)
			num[i][j] = num[i][j - 1] + a[i][j];
}

int colour(int ar, int ac, int br, int bc) {
	int res = 0;
	for (int x = ar; x <= br; x++) {
		if (num[x][bc] - num[x][ac - 1] == 0) continue;
		if (x == ar || s[x - 1][bc - 1] - s[x - 1][ac - 1] == 0) res++;
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Incorrect 0 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 384 KB Output is correct
2 Runtime error 4 ms 3840 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -