CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:Uolevi
Submission time:2019-09-30 00:28:01 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#40.01 sdetails
#50.01 sdetails
#60.01 sdetails

Code

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

int n;
vector<vector<int>> ve;
int main(){
  cin >> n;
  if(n == 1){
    cout << 1 << "\n";
  }else if(n == 2){
    cout << 1 << " " << 2 << "\n";
    cout << 2 << " " << 1 << "\n";
  }else if(n == 3){
    cout << 1 << " " << 2 << " " << 3 << "\n";
    cout << 2 << " " << 1 << " " << 4 << "\n";
    cout << 3 << " " << 4 << " " << 1 << "\n";
  }
  if(n >= 4){
    ve.push_back({1,2,3,4});
    ve.push_back({2,1,4,3});
    ve.push_back({3,4,1,2});
    ve.push_back({4,3,2,1});
    int a = 4;
    while(a < n){
      for(int i = 0; i < a; i++){
          ve[i].push_back(a+i+1);
      }
      ve.push_back({});
      for(int j = 0; j <= a; j++){
        if(j != a){
        ve[ve.size()-1].push_back(a+j+1);
      }else{
        ve[ve.size()-1].push_back(1);
      }
      }
      a++;
    }
  }
  for(auto u : ve){
    for(auto x : u){
      cout << x << " ";
    }
    cout << "\n";
  }
}

Test details

Test 1

Verdict: ACCEPTED

input
1

correct output

user output
1

Test 2

Verdict: ACCEPTED

input
2

correct output
1 2 
2 1 

user output
1 2
2 1

Test 3

Verdict: ACCEPTED

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 1 4 3 6 
3 4 1 2 7 
4 3 2 1 8 
5 6 7 8 1 

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