CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:ossikoo
Submission time:2019-10-10 15:14:25 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#30.01 sdetails
#40.01 sdetails
#50.01 sdetails
#60.01 sdetails

Code

#include <iostream>
#include <string>
using namespace std;
int get_int(int n_col, int n_offset, int n){
int v = n_col + n_offset;
if(v > n){
return v - n;
}else{
return v;
}
}
int get_new_offset(int cur_offset, int n){
int new_offset = cur_offset + 1;
if(new_offset > n){
new_offset = 0;
}
return new_offset;
}
int main() {
int n;
cin >> n;
int n_offset = 0;
for(int n_row = 1; n_row <= n; n_row++){
string row_str = "";
for(int n_col = 1; n_col <= n; n_col++){
int v = get_int(n_col, n_offset, n);
row_str += to_string(v) + " ";
}
cout << row_str << "\n";
n_offset = get_new_offset(n_offset, n);
}
}

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output

user output

Test 2

Verdict: ACCEPTED

input
2

correct output
1 2 
2 1 

user output
1 2 
2 1 

Test 3

Verdict:

input
5

correct output
1 2 3 4 5 
2 1 4 3 6 
3 4 1 2 7 
4 3 2 1 8 
5 6 7 8 1 

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

Test 4

Verdict:

input
42

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

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

Test 5

Verdict:

input
99

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

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

Test 6

Verdict:

input
100

correct output
1 2 3 4 5 6 7 8 9 10 11 12 13 ...

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