Task: | Coloring cube |
Sender: | aalto2024f_003 |
Submission time: | 2024-10-02 16:53:13 +0300 |
Language: | C++ (C++11) |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.02 s | details |
#6 | ACCEPTED | 0.02 s | details |
#7 | ACCEPTED | 0.03 s | details |
#8 | ACCEPTED | 0.09 s | details |
#9 | ACCEPTED | 0.11 s | details |
#10 | ACCEPTED | 0.11 s | details |
Code
#include <iostream> #include <vector> using namespace std; char getColor(int a){ if (a==0) return 'R'; if (a==1) return 'G'; return 'B'; } int main(){ int n; cin >> n; vector<vector<vector<int>>> cub(n, vector<vector<int>>(n,vector<int>(n,-1))); cub[0][0][0] = 0; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ for(int l=0; l<n; l++){ if(cub[i][j][l] == -1){ int pI, pJ, pL; if(i==0 or cub[i-1][j][l]==-1) pI = -1; else pI = cub[i-1][j][l]; if(j==0 or cub[i][j-1][l]==-1) pJ = -1; else pJ = cub[i][j-1][l]; if(l==0 or cub[i][j][l-1]==-1) pL = -1; else pL = cub[i][j][l-1]; if(pL != -1){ //mirar l-1 cub[i][j][l] = (pL +1)%3; } else if(pI != -1){ //mirar i-1 cub[i][j][l] = (pI +1)%3; } else if(pJ != -1){ //mirar j-1 cub[i][j][l] = (pJ +1)%3; } } cout << getColor(cub[i][j][l]); if(l!=n-1) cout << " "; } cout << endl; } if(i!= n-1)cout <<endl; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
3 |
correct output |
---|
R G B G B R B R G G B R ... |
user output |
---|
R G B G B R B R G G B R ... |
Test 2
Verdict: ACCEPTED
input |
---|
5 |
correct output |
---|
R G B R G G B R G B B R G B R R G B R G G B R G B ... |
user output |
---|
R G B R G G B R G B B R G B R R G B R G G B R G B ... Truncated |
Test 3
Verdict: ACCEPTED
input |
---|
6 |
correct output |
---|
R G B R G B G B R G B R B R G B R G R G B R G B G B R G B R ... |
user output |
---|
R G B R G B G B R G B R B R G B R G R G B R G B G B R G B R ... Truncated |
Test 4
Verdict: ACCEPTED
input |
---|
10 |
correct output |
---|
R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G ... |
user output |
---|
R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B R G B ... Truncated |
Test 5
Verdict: ACCEPTED
input |
---|
50 |
correct output |
---|
R G B R G B R G B R G B R G B ... |
user output |
---|
R G B R G B R G B R G B R G B ... Truncated |
Test 6
Verdict: ACCEPTED
input |
---|
53 |
correct output |
---|
R G B R G B R G B R G B R G B ... |
user output |
---|
R G B R G B R G B R G B R G B ... Truncated |
Test 7
Verdict: ACCEPTED
input |
---|
63 |
correct output |
---|
R G B R G B R G B R G B R G B ... |
user output |
---|
R G B R G B R G B R G B R G B ... Truncated |
Test 8
Verdict: ACCEPTED
input |
---|
95 |
correct output |
---|
R G B R G B R G B R G B R G B ... |
user output |
---|
R G B R G B R G B R G B R G B ... Truncated |
Test 9
Verdict: ACCEPTED
input |
---|
99 |
correct output |
---|
R G B R G B R G B R G B R G B ... |
user output |
---|
R G B R G B R G B R G B R G B ... Truncated |
Test 10
Verdict: ACCEPTED
input |
---|
100 |
correct output |
---|
R G B R G B R G B R G B R G B ... |
user output |
---|
R G B R G B R G B R G B R G B ... Truncated |