Codeforces Round #444 (Div. 2), problem: (C) Solution for Cube Solution In C/C++

#include <bits/stdc++.h>
using namespace std;

const int R[6][8] = {
{12, 13, 4, 5, 16, 17, 20, 21},
{14, 15, 6, 7, 18, 19, 22, 23},
{ 0, 2, 4, 6, 8, 10, 23, 21},
{ 1, 3, 5, 7, 9, 11, 22, 20},
{ 2, 3, 16, 18, 9, 8, 15, 13},
{ 0, 1, 17, 19, 11, 10, 14, 12}
};

int a[24];
int b[24];

int main()
{
for (int i = 0; i < 24; i++)
scanf(“%d”, a + i);

for (int i = 0; i < 6; i++)
{
for (int j = 0; j < 24; j++)
b[j] = a[j];

for (int j = 0; j < 8; j++)
b[R[i][j]] = a[R[i][(j + 2) % 8]];

bool valid = true;

for (int j = 0; j < 24; j += 4)
if (b[j] != b[j + 1] || b[j + 1] != b[j + 2] || b[j + 2] != b[j + 3])
valid = false;

if (valid)
{
puts(“YES”);

return 0;
}
}

puts(“NO”);

return 0;
}

Is Nate Dead in...

The latest season of HBO's hit teen drama has...

Why Everyone is Obsessed with the Stain Remover for Clothes

Are you tired of dealing with everyday frustrations that slow down your routine? We've all been...

臨床組織科学(COS)とサイバネティクス──Wiener・Meadowsから見るフィードバック循環構造

In the rapidly evolving landscape of modern organizational management, a groundbreaking concept is emerging that bridges the gap between scientific theory and practical business...

Why Everyone is Obsessed with the Digital Meat Thermometer

Are you tired of dealing with everyday frustrations that slow down your routine? We've all been...

Why Everyone is Obsessed with the Keyboard Cleaning Gel Putty

Are you tired of dealing with everyday frustrations that slow down your routine? We've all been...

Is Nate Dead in ‘Euphoria’? Season 3 Episode 7 Ending Explained

The latest season of HBO's hit teen drama has kept viewers on the edge of their seats, but nothing could have prepared fans for...

Why Everyone is Obsessed with the Real Techniques Makeup Sponge

Are you tired of dealing with everyday frustrations that slow down your routine? We've all been...

Why Everyone is Obsessed with the Heavy Duty Duck Tape

Are you tired of dealing with everyday frustrations that slow down your routine? We've all been...

Oakley Brings Back the FatCat from the Archive

Oakley is renowned for pushing the boundaries of eyewear design, and now they are digging deep into their historical vault to bring back a...

Why Everyone is Obsessed with the Reusable Water Balloon Set

Are you tired of dealing with everyday frustrations that slow down your routine? We've all been...