Submission #232321

# Submission time Handle Problem Language Result Execution time Memory
232321 2020-05-16T17:34:39 Z pedy4000 Trapezi (COI17_trapezi) C++14
0 / 100
5 ms 384 KB
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

typedef long long ll;
typedef pair <int, int> pii;

const int N = 1e3 + 3;
int n, m;
string s[N];

pii nxt (pii p) {
	if (p.first == 0) {
		if (p.second == 2)
			return pii(1, 2);
		return pii(p.first, p.second + 1);
	}
	if (p.second == 0)
		return pii(0, 0);
	return pii(p.first, p.second - 1);
}

char get (pii p) {
	return s[p.first][p.second];
}

void upd (pii p) {
	s[p.first][p.second] = '1';
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	if (n == 1) {
		cin >> s[0] >> s[1];
		int num = 0;
		for (int i = 0; i < 2; i++)
			for (int j = 0; j < 3; j++)
				num += s[i][j] == '0';

		if (num % 3) {
			cout << "nemoguce\n";
			return 0;
		}
		if (num  == 0) {
			cout << s[0] << " " << s[1] << "\n";
			return 0;
		}
		for (int i = 0; i < 2; i++)
			for (int j = 0; j < 3; j++) {
				if (s[i][j] == '0' && get(nxt(pii(i, j))) == '0' && get(nxt(nxt(pii(i, j)))) == '0') {
					s[i][j] = '1';
					upd(nxt(pii(i, j)));
					upd(nxt(nxt(pii(i, j))));
					cout << s[0] << "\n" << s[1] << "\n";
					return 0;
				}
			}


		cout << "nemoguce\n";
		return 0;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -