Submission #161998

# Submission time Handle Problem Language Result Execution time Memory
161998 2019-11-05T16:12:35 Z Minnakhmetov Land of the Rainbow Gold (APIO17_rainbow) C++14
0 / 100
4 ms 504 KB
#include "rainbow.h"
#include <bits/stdc++.h>

using namespace std;

#define all(aaa) aaa.begin(), aaa.end()

string dir = "NSEW";
const int dx[4] = {-1, 1, 0, 0},
		  dy[4] = {0, 0, 1, -1};

const int N = 52;
int a[N][N];

void init(int R, int C, int sr, int sc, int M, char *S) {
	a[sr][sc] = 1;

	int x = sr, y = sc;
	for (int i = 0; i < M; i++) {
		int k = find(all(dir), S[i]) - dir.begin();
		x += dx[k];
		y += dy[k];
		a[x][y] = 1;
	}

	for (int i = 1; i <= R; i++) {
		for (int j = 1; j <= C; j++) {
			cout << a[i][j];
		}
		cout << "\n";
	}
}

int colour(int ar, int ac, int br, int bc) {
	int ans = 1;

	for (int i = ar + 1; i < br; i++) {
		for (int j = ac; j < bc; j++) {
			ans += (a[i][j] && a[i][j + 1]);
		}
	}

	for (int i = ar; i < br; i++) {
		for (int j = ac + 1; j < bc; j++) {
			ans += (a[i + 1][j] && a[i][j]);
		}
	}

	for (int i = ar; i <= br; i++) {
		for (int j = ac; j <= bc; j++) {
			ans -= a[i][j];
		}
	}

	for (int i = ar; i <= br; i++) {
		ans += a[i][ac] + a[i][bc];
	}

	for (int i = ac; i <= bc; i++) {
		ans += a[ar][i] + a[br][i];
	}

	for (int i = ar; i < br; i++) {
		for (int j = ac; j < bc; j++) {
			ans -= (a[i][j] && a[i + 1][j] && 
				a[i][j + 1] && a[i + 1][j + 1]);
		}
	}

	ans -= a[ar][ac] + a[ar][bc] + a[br][ac] + a[br][bc];

	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -