CSES - Datatähti 2021 alku - Results
Submission details
Task:Arpakuutiot
Sender:shmoul
Submission time:2020-10-06 18:08:38 +0300
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp:3:11: error: '::main' must return 'int'
 void main()
           ^

Code

#include <iostream>

void main()
{
	int count;
	std::cin >> count;
	int *diceId = new int[count];
	std::string* dice = new std::string[5];
	for (int i = 0; i < count; i++)
	{
		diceId[i] = 0;
		for (int j = 0; j < 5; j++)
		{
			std::cin >> dice[j];
		}
		int noPair[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
		int noCount = 0;
		for (int j = 0; j < 5; j++)
		{
			for (int k = 0; k < 5; k++)
			{
				int c = dice[j][k];
				if (c == '.' || c == '\0') continue;
				//c -= '0';
				if (j >= 2 && dice[j - 2][k] != '.') diceId[i] += c * (dice[j - 2][k]);
				else if (j <= 2 && dice[j + 2][k] != '.') diceId[i] += c * (dice[j + 2][k]);
				else if (k <= 2 && dice[j][k + 2] != '.') diceId[i] += c * (dice[j][k + 2]);
				else if (k >= 2 && dice[j][k - 2] != '.') diceId[i] += c * (dice[j][k - 2]);                
				else 
				{
					noPair[noCount++] = j;
					noPair[noCount++] = k;
				}
			}
			//std::cout << diceId[i] << "\n";
		}
		if (noCount<4 && noCount>0) diceId[i] += 2 * dice[noPair[0]][noPair[1]] * dice[noPair[2]][noPair[3]];
		else if(noCount>4)
		{
			diceId[i] += 2 * dice[noPair[0]][noPair[1]] * dice[noPair[4]][noPair[5]];
			diceId[i] += 2 * dice[noPair[2]][noPair[3]] * dice[noPair[6]][noPair[7]];
		}
		//std::cout << ">" << diceId[i] << "\n";
	}
    for (int i = 0; i < count; i++)
	{
		std::cout << "Dice " << i << " = " << diceId[i] << "\n";
	}
	for (int i = 0; i < count; i++)
	{
		int t = 0;
		bool first = true;
		for (int j = 0; j < count; j++)
		{
			if (diceId[i] == diceId[j] && i != j)
			{
				if (first) std::cout << j + 1;
				else std::cout << " " << j + 1;
				first = false;
				t++;
			}
		}
		if (t == 0) std::cout << "-";
		std::cout << "\n";
	}
}