CSES - Datatähti 2021 alku - Results
Submission details
Task:Arpakuutiot
Sender:hltk
Submission time:2020-10-03 21:01:59 +0300
Language:C++17
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:414:19: error: reference to 'data' is ambiguous
   const char* k = data;
                   ^~~~
input/code.cpp:6:13: note: candidates are: const char* data
 const char *data =
             ^~~~
In file included from /usr/include/c++/7/string:51:0,
                 from /usr/include/c++/7/bits/locale_classes.h:40,
                 from /usr/include/c++/7/bits/ios_base.h:41,
                 from /usr/include/c++/7/ios:42,
                 from /usr/include/c++/7/ostream:38,
                 from /usr/include/c++/7/iostream:39,
                 from input/code.cpp:1:
/usr/include/c++/7/bits/range_access.h:318:5: note:                 template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)
     data(initializer_list<_Tp> __il) noexcept
     ^~~~
/usr/include/c++/7/bits/range_access.h:309:5: note:                 template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])
     data(_Tp (&...

Code

#include <iostream>
#include <map>
#include <vector>
using namespace std;

const char *data =
"........0....1....2...345"
"........0....1...325...4."
"...0...315.42............"
".............0.5431...2.."
".............0..431....25"
"............0....154.32.."
"..0....1....2...345......"
"...01...3...42....5......"
".......0...315....24....."
".......0....15..32...4..."
".....0....1543...2......."
"...0....1....25....4....3"
".0....1....25..34........"
".......01.543....2......."
".....0....15....24....3.."
"........0.5431.2........."
"......0....1....2...345.."
"...............012....345"
"..............0..431.52.."
"...0.5431...2............"
"..0...3154...2..........."
"....0...31..42....5......"
"...0...31..42....5......."
".......0....15....24...3."
".0...3154...2............"
"........0..4315...2......"
".0....154....23.........."
".......0...315.42........"
"............01.543....2.."
".............0..4315..2.."
"........01.543..2........"
"........0....15...2...34."
".......0..4315...2......."
".......0....1...325....4."
"......01....325..4......."
"...01...3....2...45......"
"............0...315.42..."
"0....1543...2............"
"...0....1....25..34......"
".......0....154...2....3."
"0....15....2....34......."
"..............0.5431....2"
".........0...31..42...5.."
"......0....15..32...4...."
"........0....1...32....45"
".........0.5431.2........"
".......0...31..42...5...."
".0....1543..2............"
"..0....1...325...4......."
"...0..4315..2............"
".......0....154.32......."
"...0..431...2....5......."
"..............0.5431.2..."
"....0...31..42...5......."
"........0...31..42....5.."
".......01...3....2...45.."
"......0...315...2....4..."
"012....345..............."
".......01...3...42...5..."
"....0....1...32...4....5."
"..0....15..32...4........"
"........0...315.42......."
"..........01....325....4."
"01....32...4....5........"
".0...31....25....4......."
".........0...31...2...45."
"......012...3....4....5.."
"..012...3....4....5......"
"..012543................."
".01...3...42....5........"
".01....325...4..........."
".......01.543...2........"
"......01....325...4......"
"..0...31....25...4......."
"........0...315...2....4."
"......0....1...325....4.."
"............0..431....25."
"............01.543...2..."
"..0....15..32....4......."
"............0...3154...2."
"..0..431....25..........."
".0...31....2....45......."
"..0....154...2....3......"
".0....15..32....4........"
"........0....1....25..34."
"............01.543..2...."
"..0..431...2....5........"
".....01....3....42...5..."
"..0....1....25..34......."
"........0.5431...2......."
"......0...3154..2........"
"............0..4315...2.."
"..........0....1543.2...."
"..........01....32....45."
".0....1...325....4......."
".........0.5431...2......"
".......0..431...2....5..."
".......0....1...325...4.."
"..0....15....24...3......"
"...01..43..52............"
"...0..4315...2..........."
".......0...3154...2......"
"...0...315...2....4......"
"..01...3....2...45......."
"...0...31..42...5........"
"........0....1...325..4.."
"...........01....325..4.."
"..0....154.32............"
"........0.5431..2........"
"........0....15..32...4.."
"........01...3...42...5.."
"............0..4315....2."
"...........0....1543....2"
"....0...31...2...45......"
".....01....3....4....52.."
"...........0...3154..2..."
"......0...31....2....45.."
".......0...315...2....4.."
"0....1543..2............."
".0....1...32....45......."
"..0....15....24....3....."
"......0....154....23....."
"........0...31...2...45.."
"...........01....325....4"
"........0....1...325....4"
".0...315....24..........."
"..01.543..2.............."
"..0...315....24.........."
"............012543......."
"......0...315....24......"
".....0....15....2....34.."
"........0..431....25....."
"......0...31....25....4.."
"......01..43....2....5..."
"...0...31....25....4....."
".0...315...2....4........"
".0....1....2...345......."
"....0.5431....2.........."
"............0...315....24"
"............01..43..52..."
".01..43....2....5........"
"........0...31..42...5..."
".............0.5431..2..."
"....0..431.52............"
".......0....15....2....34"
"..0...3154....2.........."
".............01.543....2."
".......0..4315.2........."
"..0...3154.2............."
".......0....15....24....3"
"........0....15..32....4."
"..0....15...2...34......."
"...01.543...2............"
".012...3....4....5......."
"......01....3....42...5.."
".......01.543..2........."
"..............0.5431...2."
"...01..43....2....5......"
".....012....345.........."
"...........0....1543...2."
".......012...3....4....5."
"...0...31....25...4......"
"...........01....32....45"
".........0.5431..2......."
".0....1543....2.........."
"01....325...4............"
"...........0...3154....2."
".0...3154..2............."
".....01....325..4........"
"..0..4315.2.............."
"..01..43..52............."
".....01....325....4......"
".01....325....4.........."
"...0.5431....2..........."
".01....3....42...5......."
"....0.5431...2..........."
".0....1...325..4........."
"......0....15....24...3.."
".0....1543...2..........."
"01....325....4..........."
".............0..431.52..."
"............0...3154....2"
".........0.5431....2....."
"....0.5431..2............"
".0....154.32............."
"..........0....1543...2.."
"......0....154.32........"
"0....1543....2..........."
".01....325..4............"
".....01....32....45......"
"01....325..4............."
"......0....1...32....45.."
"..0....1...325....4......"
"......0....1543.2........"
"........0..4315.2........"
"...........0....1543..2.."
".......01....3....42...5."
".....0....154...2....3..."
"......0...31....25...4..."
".............0.5431....2."
".............01.543..2..."
"......0....1...325..4...."
"...0..431....25.........."
".....0....1543.2........."
".....01....325...4......."
"......0....15....24....3."
"......0....1543....2....."
"01....3....42....5......."
".0...3154.2.............."
".......01....3....42....5"
".......0...31...2...45..."
"...0..4315.2............."
".....0....1543..2........"
"..01....32...4....5......"
".0....15....24...3......."
"..0...31..42....5........"
"01....32....45..........."
"......01...3...42....5..."
".........0..431.52......."
"..........012....345....."
"..0....15....2....34....."
"...0....1...32...4....5.."
"..........01....325...4.."
"....0..431...2....5......"
"........01.543....2......"
".............0..4315.2..."
"............0..4315.2...."
".0....154...2....3......."
".......0...31..42....5..."
".01...3...42...5........."
".......0....1...32....45."
"...........01....325...4."
"...0..431.52............."
"......0....1543..2......."
".......0...3154..2......."
"..............0.5431..2.."
"......01....32....45....."
"........0..431.52........"
".....01....32...4....5..."
"..01...3...42....5......."
".............0.5431.2...."
"...0....15..32...4......."
".......0....1...325..4..."
"...0.5431..2............."
"..0...31..42...5........."
"...0....1...32....45....."
".............0..4315...2."
".......0....1....25..34.."
"...........0....154....23"
".....01....3....42....5.."
".0....15...2...34........"
"...........0...3154.2...."
".........0...31..42....5."
"........01...3...42....5."
"..........0....154....23."
".....0....154....23......"
"..0...31....25....4......"
"........0..4315....2....."
".0....15....24....3......"
".......0..431....25......"
"..0...31....2....45......"
"......0....1543...2......"
"..0...315.42............."
"..01....3....42....5....."
".......012543............"
"........0..4315..2......."
"......0....15....2....34."
"......01...3...42...5...."
"0....15....24....3......."
"..0....1....25....4....3."
"......0....154...2....3.."
"......0...3154.2........."
"..0....1...325..4........"
"........01.543...2......."
"..01...3...42...5........"
".......01..43....2....5.."
".......0...31....2....45."
".01...3....2...45........"
"............0...3154.2..."
".0....1...32...4....5...."
"....0.5431.2............."
"...0....1...325..4......."
".0...3154....2..........."
"......01....3....42....5."
"............0..4315..2..."
"..........0....1543....2."
"..0...31...2...45........"
"..01.543...2............."
"0....154....23..........."
"......0...3154....2......"
".......0...31....25...4.."
"...0....15...2...34......"
"......01...3....2...45..."
".............01..43..52.."
"......01....325....4....."
".....0....1543....2......"
"........0.5431....2......"
".01....3....4....52......"
"........01..43..52......."
"...0...31...2...45......."
".......01....3....4....52"
"..0..4315....2..........."
"..0....1...32...4....5..."
".......01..43..52........"
"...01.543..2............."
"..01....3....4....52....."
"........0..431...2....5.."
".0....15....2....34......"
".............0..4315....2"
"..0..4315..2............."
"0....1....25....4....3..."
"...01...3...42...5......."
".....012...3....4....5..."
"...0..4315....2.........."
"...0...31....2....45....."
"..0..4315...2............"
".....0....15....24...3..."
"0....15....24...3........"
"01....3....42...5........"
".0....1...325...4........"
".................012543.."
"..........01....325..4..."
"........0...31....25....4"
"..01....3....42...5......"
"...0....15..32....4......"
"..0....1...32....45......"
"......0....1....25..34..."
".............0...315.42.."
"......01....32...4....5.."
".0....1....25....4....3.."
"..01.543....2............"
"...........0....1543.2..."
"012...3....4....5........"
".......0....15...2...34.."
".01....32...4....5......."
".......0....15..32....4.."
"...0....1....2...345....."
".......0...3154.2........"
"0....154...2....3........"
"..0...315...2....4......."
".0....1543.2............."
".......01....32...4....5."
"..0...3154..2............"
"........0...31....25...4."
"......01....3....4....52."
"........01..43....2....5."
".......0....1....2...345."
".........0..431...2....5."
"........0...31....2....45"
"..01..43....2....5......."
"...0....1...325....4....."
"...01.543....2..........."
".......0..4315....2......"
"......0...3154...2......."
"......0....1...325...4..."
"............0...3154..2.."
".0...31....25...4........"
"..........0....1543..2..."
"...........0...3154...2.."
".......0...3154....2....."
"...0.5431.2.............."
".......0..4315..2........"
".0....15..32...4........."
"...........0....154.32..."
"...........0...315....24."
"........01...3....2...45."
"...0....1...325...4......"
".......0...31....25....4."
".......01...3...42....5.."
"......0....15..32....4..."
"0....1543.2.............."
"......0....15...2...34..."
".............01.543...2.."
"01....3....4....52......."
".01....3....42....5......"
".01....32....45..........";

int rot_map[][4] = {
	{1, 3, 4, 5},
	{5, 2, 3, 0},
	{0, 1, 2, 4}
};

void do_rot(int* r, vector<int>& k) {
	for (int j = 0; j < 3; ++j)
		swap(k[r[j]], k[r[j + 1]]);
}

bool matches(const char *a, const char *b) {
	for (int j = 0; j < 25; ++j)
		if ((a[j] == '.') != (b[j] == '.'))
			return false;
	return true;
}

int main() {
	int n;
	cin >> n;

	map<vector<int>, vector<int>> occ;
	vector<vector<int>> p;

	for (int i = 0; i < n; ++i) {
		char inp[25];
		for (int j = 0; j < 25; ++j)
			cin >> inp[j];
		vector<int> w(6);
		const char* k = data;
		for (; !matches(inp, k); k += 25);
		for (int j = 0; j < 25; ++j)
			if (k[j] != '.')
				w[k[j] - '0'] = inp[j] - '0';
		if (w[1] == 1 || w[4] == 1) do_rot(rot_map[0], w);
		while (w[3] != 1) do_rot(rot_map[1], w);
		while (w[1] != (w[5] == 2 ? 3 : 2)) do_rot(rot_map[2], w);
		p.push_back(w);
		occ[w].push_back(i);
	}

	for (int i = 0; i < n; ++i) {
		if (occ[p[i]].size() == 1) {
			cout << "-\n";
		} else {
			for (int j : occ[p[i]])
				if (i != j)
					cout << j + 1 << " ";
			cout << "\n";
		}
	}
}