CSES - Aalto Competitive Programming 2024 - wk5 - Wed - Results
Submission details
Task:Coloring cube
Sender:aalto2024f_004
Submission time:2024-10-02 16:23:05 +0300
Language:C++ (C++17)
Status:READY
Result:ACCEPTED
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#3ACCEPTED0.00 sdetails
#4ACCEPTED0.00 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.01 sdetails
#7ACCEPTED0.02 sdetails
#8ACCEPTED0.04 sdetails
#9ACCEPTED0.04 sdetails
#10ACCEPTED0.04 sdetails

Code

// ~/.vim/cpp_template.cpp
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

#define REP(i,a,b) for (int i = a; i < b; i++)

// Type Aliases for 1D and 2D vectors with initialization
#define vi(n, val) vector<int>(n, val) // 1D vector of ints with size n, initialized to val
#define vll(n, val) vector<long long>(n, val) // 1D vector of long longs with size n, initialized to val
#define ll long long
#define vvi(n, m, val) vector<vector<int>>(n, vector<int>(m, val)) // 2D vector of ints (n x m), initialized to val
#define vvll(n, m, val) vector<vector<long long>>(n, vector<long long>(m, val)) // 2D vector of long longs (n x m), initialized to val


using namespace std;

template <typename T>
void pV(const std::vector<T>& vec, const std::string& label = "Vector") {
    std::cout << label << ": [ ";
    for (const auto& elem : vec) {
        std::cout << elem << " ";
    }
    std::cout << "]" << std::endl;
}


using namespace std;


void dfs(int s, vector<bool> *visited, vector<int> (*adj)[]) {
    if ((*visited)[s]) return;
    (*visited)[s] = true;
    // process node s


    for (auto u: (*adj)[s]) {
        dfs(u, visited, adj);
    }
}
/*
vector<int> adj[N];                                                          
vector<bool> visited(N, false);
int u, v;
for(int i = 0; i < M;i++){
    cin >> u >> v;
    u--;
    v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
}
*/

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    // Your code starts here
    int n;
    cin >> n;
    REP(i, 0, n){
        int cnt = i % 3;
        REP(j, 0, n){
            REP(k, 0, n){
                int val = (cnt+j+k)%3;
                if(val == 0){
                    cout << "R ";
                }else if(val == 1){
                    cout << "G ";
                }else{
                    cout << "B ";
                }
            }
            cout << endl;
        }
        cout << endl;
    }

    return 0;
}


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 
...
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