CSES - Datatähti 2021 alku - Results
Submission details
Task:Ratsun reitit
Sender:T
Submission time:2020-10-08 02:43:06 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.01 s1, 2, 3details
#30.01 s1, 2, 3details
#40.01 s1, 2, 3details
#50.01 s1, 2, 3details
#60.01 s1, 2, 3details
#70.01 s1, 2, 3details
#80.01 s2, 3details
#90.01 s2, 3details
#100.01 s2, 3details
#110.01 s3details
#120.01 s3details
#130.01 s3details

Code

/**
* Datat?hti 2021 alku
* Arpakuutiot/Dice
* @author TRS
*/
//Include
#include <bits/stdc++.h>
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <utility>
#include <list>
#include <queue>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <regex>
#include <iterator>
//Definitions
using namespace std;
using ll = long long;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<string, string> pss;
typedef vector<int> vi;
typedef vector<pii> vpii;
#define pb push_back
#define mp make_pair
#define mt make_tuple
//Constants
#define infinity 0x3f3f3f3f
#define linfinity 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
const int MX = 21;
int dice[MX][5][5];
int answer[MX][MX];
int n;
int checkDice(int a1[4], int a2[4]) {
if (a1[0] == a2[0] && a1[1] == a2[1] && a1[2] == a2[2] && a1[3] == a2[3]) {
return 1;
}
if (a1[0] == a2[1] && a1[1] == a2[2] && a1[2] == a2[3] && a1[3] == a2[0]) {
return 1;
}
if (a1[0] == a2[2] && a1[1] == a2[3] && a1[2] == a2[0] && a1[3] == a2[1]) {
return 1;
}
if (a1[0] == a2[3] && a1[1] == a2[0] && a1[2] == a2[1] && a1[3] == a2[2]) {
return 1;
}
return 0;
}
int result(int dice1[5][5], int dice2[5][5]) {
int d1[7] = {0, dice1[0][0], dice1[0][1], dice1[0][2], dice1[1][1], dice1[2][1], dice1[3][1]};
int d2[7] = {0, dice2[0][0], dice2[0][1], dice2[0][2], dice2[1][1], dice2[2][1], dice2[3][1]};
int d2side[4] = {d2[2], d2[4], d2[5], d2[6]};
if (d1[1] == d2[1]) {
if (d1[3] != d2[3]) {
return 0;
}
int d1side[4] = {d1[2], d1[4], d1[5], d1[6]};
return checkDice(d1side, d2side);
}
if (d1[2] == d2[1]) {
if (d1[5] != d2[3]) {
return 0;
}
int d1side[4] = {d1[1], d1[6], d1[3], d1[4]};
return checkDice(d1side, d2side);
}
if (d1[3] == d2[1]) {
if (d1[1] != d2[3]) {
return 0;
}
int d1side[4] = {d1[2], d1[6], d1[5], d1[4]};
return checkDice(d1side, d2side);
}
if (d1[4] == d2[1]) {
if (d1[6] != d2[3]) {
return 0;
}
int d1side[4] = {d1[1], d1[2], d1[3], d1[5]};
return checkDice(d1side, d2side);
}
if (d1[5] == d2[1]) {
if (d1[2] != d2[3]) {
return 0;
}
int d1side[4] = {d1[1], d1[4], d1[3], d1[6]};
return checkDice(d1side, d2side);
}
if (d1[6] == d2[1]) {
if (d1[4] != d2[3]) {
return 0;
}
int d1side[4] = {d1[1], d1[5], d1[3], d1[2]};
return checkDice(d1side, d2side);
}
return 0;
}
void convertDice(int d[5][5]) {
int d0[5][5];
int minRow = 5, minColumn = 5, maxRow = 0, maxColumn = 0;
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
d0[i][j] = 0;
if (d[i][j] != 0) {
if (i < minRow) {
minRow = i;
}
if (i > maxRow) {
maxRow = i;
}
if (j < minColumn) {
minColumn = j;
}
if (j > maxColumn) {
maxColumn = j;
}
}
}
}
if (maxRow - minRow < maxColumn - minColumn) {
for (int i = minRow; i <= maxRow; i++) {
for (int j = minColumn; j <= maxColumn; j++) {
d0[j - minColumn][2 - i + minRow] = d[i][j];
}
}
}
else {
for (int i = minRow; i <= maxRow; i++) {
for (int j = minColumn; j <= maxColumn; j++) {
d0[i - minRow][j - minColumn] = d[i][j];
}
}
}
for (int i = 0; i < 4; i++) {
if (d0[i][1] == 0) {
d0[i][1] = d0[i][0] + d0[i][2];
d0[i][0] = d0[i][2] = 0;
}
}
for (int j = 0; j < 3; j++) {
if (d0[0][j] == 0) {
d0[0][j] = d0[1][j] + d0[2][j] + d0[3][j];
d0[1][j] = d0[2][j] = d0[3][j] = 0;
}
}
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
d[i][j] = d0[i][j];
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < 5; j++) {
for (int k = 0; k < 5; k++) {
dice[i][j][k] = 0;
char c = getchar();
if (c < '7' && c > '0') {
dice[i][j][k] = c - '0';
}
}
getchar();
}
//convertDice(dice[i]);
getchar();
}
for (int i = 0; i < n; i++) {
answer[i][i] = 0;
for (int j = i + 1; j < n; j++) {
answer[i][j] = result(dice[i], dice[j]);
answer[j][i] = answer[i][j];
}
}
for (int i = 0; i < n; i++) {
int similar = 0;
for (int j = 0; j < n; j++) {
if (answer[i][j]) {
if (similar) {
putchar(' ');
}
printf("%d", j + 1);
similar = 1;
}
}
if (!similar) {
putchar('-');
}
putchar('\n');
}
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
4

correct output
0 3 2 5 
3 4 1 2 
2 1 4 3 
5 2 3 2 

user output
2 3 4
1 3 4
1 2 4
1 2 3

Test 2

Group: 1, 2, 3

Verdict:

input
5

correct output
0 3 2 3 2 
3 4 1 2 3 
2 1 4 3 2 
3 2 3 2 3 
2 3 2 3 4 

user output
2 3 4 5
1 3 4 5
1 2 4 5
1 2 3 5
1 2 3 4

Test 3

Group: 1, 2, 3

Verdict:

input
6

correct output
0 3 2 3 2 3 
3 4 1 2 3 4 
2 1 4 3 2 3 
3 2 3 2 3 4 
2 3 2 3 4 3 
...

user output
2 3 4 5 6
1 3 4 5 6
1 2 4 5 6
1 2 3 5 6
1 2 3 4 6
...

Test 4

Group: 1, 2, 3

Verdict:

input
7

correct output
0 3 2 3 2 3 4 
3 4 1 2 3 4 3 
2 1 4 3 2 3 4 
3 2 3 2 3 4 3 
2 3 2 3 4 3 4 
...

user output
2 3 4 5 6 7
1 3 4 5 6 7
1 2 4 5 6 7
1 2 3 5 6 7
1 2 3 4 6 7
...

Test 5

Group: 1, 2, 3

Verdict:

input
8

correct output
0 3 2 3 2 3 4 5 
3 4 1 2 3 4 3 4 
2 1 4 3 2 3 4 5 
3 2 3 2 3 4 3 4 
2 3 2 3 4 3 4 5 
...

user output
2 3 4 5 6 7 8
1 3 4 5 6 7 8
1 2 4 5 6 7 8
1 2 3 5 6 7 8
1 2 3 4 6 7 8
...
Truncated

Test 6

Group: 1, 2, 3

Verdict:

input
9

correct output
0 3 2 3 2 3 4 5 4 
3 4 1 2 3 4 3 4 5 
2 1 4 3 2 3 4 5 4 
3 2 3 2 3 4 3 4 5 
2 3 2 3 4 3 4 5 4 
...

user output
2 3 4 5 6 7 8 9
1 3 4 5 6 7 8 9
1 2 4 5 6 7 8 9
1 2 3 5 6 7 8 9
1 2 3 4 6 7 8 9
...
Truncated

Test 7

Group: 1, 2, 3

Verdict:

input
10

correct output
0 3 2 3 2 3 4 5 4 5 
3 4 1 2 3 4 3 4 5 6 
2 1 4 3 2 3 4 5 4 5 
3 2 3 2 3 4 3 4 5 6 
2 3 2 3 4 3 4 5 4 5 
...

user output
2 3 4 5 6 7 8 9 10
1 3 4 5 6 7 8 9 10
1 2 4 5 6 7 8 9 10
1 2 3 5 6 7 8 9 10
1 2 3 4 6 7 8 
...
Truncated

Test 8

Group: 2, 3

Verdict:

input
25

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
2 3 4 5 6 7 8 9 10 11 12 13 14...
Truncated

Test 9

Group: 2, 3

Verdict:

input
49

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
2 3 4 5 6 7 8 9 10 11 12 13 14...
Truncated

Test 10

Group: 2, 3

Verdict:

input
50

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
2 3 4 5 6 7 8 9 10 11 12 13 14...
Truncated

Test 11

Group: 3

Verdict:

input
75

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
2 3 4 5 6 7 8 9 10 11 12 13 14...
Truncated

Test 12

Group: 3

Verdict:

input
99

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
2 3 4 5 6 7 8 9 10 11 12 13 14...
Truncated

Test 13

Group: 3

Verdict:

input
100

correct output
0 3 2 3 2 3 4 5 4 5 6 7 6 7 8 ...

user output
2 3 4 5 6 7 8 9 10 11 12 13 14...
Truncated