Submission #1247002

#TimeUsernameProblemLanguageResultExecution timeMemory
1247002lukavMosaic (IOI24_mosaic)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
using namespace std;

string to_string(vector<int> numbers) {
	string text = "{";
	for (auto i = numbers.begin(); i != numbers.end(); i++) {
		text += to_string(*i);
		//if (next(i) != numbers.end()) {text += ", "}
	} text += '}';
	return text;
}
string to_string(vector<vector<int>> numbers) {
	string text = "";
	for (auto i = numbers.begin(); i != numbers.end(); i++) {
		text += to_string(*i);
		if (next(i) != numbers.end()) {text += "\n";}
	} // text += '}';
	return text;
}
vector<long long> mosaic(vector<int> X, vector<int> Y, vector<int> T, vector<int> B, vector<int> L, vector<int> R) {
	int n = X.size(), q = T.size();
	vector<vector<int>> hormatrix(3, vector<int>(n)), vermatrix(n, vector<int>(3));
	hormatrix[0] = X;
	for (int i = 0; i <= 2; i++) {
		hormatrix[i][0] = Y[i];
	} for (int i = 1; i <= 2; i++) {
		for (int j = 1; j < n; j++) {
			if (hormatrix[i - 1][j] == 0 && hormatrix[i][j - 1] == 0) {
				hormatrix[i][j] = 1;
			} else {hormatrix[i][j] = 0;}
		}
	} for (int j = 0; j <= 2; j++) {
		vermatrix[0][j] = X[j];
	} for (int i = 0; i < n; i++) {
		vermatrix[i][0] = Y[i];
	} for (int i = 1; i < n; i++) {
		for (int j = 1; j <= 2; j++) {
			if (vermatrix[i - 1][j] == 0 && vermatrix[i][j - 1] == 0) {
				vermatrix[i][j] = 1;
			} else {vermatrix[i][j] = 0;}
		}
	}

	vector<long long> answers;
	for (int i = 0; i < q; i++) {
		int top = T[i], bottom = B[i], left = L[i], right = R[i];
		if (top == bottom && left == right) {
			int answ;
			if (top > 2 && left > 2) {
				int minimum = min(top, left);
				top -= minimum - 2;
				left -= minimum - 2;
			} if (top <= 2) {
				answ = hormatrix[top][left];
			} else if (left <= 2) {
				answ = vermatrix[top][left];
			} answers.push_back(answ);
		}
	}
	//cout << to_string(hormatrix) << endl << endl << to_string(vermatrix)
	return answers;
}
int main() {
	vector<int> X = {0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0};
	vector<int> Y = {0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0};
	vector<int> T = {2};
	vector<int> B = {4};
	vector<int> L = {0};
	vector<int> R = {5};
	//mosaic(X, Y, T, B, L, R);
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccngxF81.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccUtx5Mp.o:mosaic.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status