CSES - Datatähti 2020 alku - Results
Submission details
Task:Ruudukko
Sender:jusola
Submission time:2019-10-01 18:36:42 +0300
Language: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.02 sdetails
#60.02 sdetails

Code

#include <iostream>
#include <fstream>
#include <stdlib.h>
#include <string>
#include <algorithm>
#include <iterator>


using namespace std;

int main(){
  int num;
  cin >> num;

  int arr[101][101];

  for (int x = 0; x < num; x++){
    for (int y = 0; y < num; y++){
      int smallestX = 0;
      bool Xfound = false;
      int smallestY = 0;
      bool Yfound = false;
      int arrX[101];
      int arrY[101];
      for(int i = 0; i < num; i++){
        arrX[i] = arr[i][y];
      }
      for(int i = 0; i < num; i++){
        arrY[i] = arr[x][i];
      }
      while(!Xfound){
        smallestX++;
        int *xPointer = std::find(std::begin(arrX), std::end(arrX), smallestX);
        if(xPointer == std::end(arrX)){
          Xfound = true;
        }
        if(x == 0){
          Xfound = true;
        }
      }
      while(!Yfound){
        smallestY++;
        int *yPointer = std::find(std::begin(arrY), std::end(arrY), smallestY);
        if(yPointer == std::end(arrY)){
          Yfound = true;
        }
        if(y == 0){
          Yfound = true;
        }
      }
      if(smallestY > smallestX){
        arr[x][y] = smallestY;
      }else{
        arr[x][y] = smallestX;
      }

    }
  }

  for(int x2 = 0; x2 < num; x2++)
  {
    for(int y2 = 0; y2 < num; y2++)
    {
          cout<<" "<<arr[x2][y2]<<" ";
    }
    cout<<"\n";
  }

  return 0;
}

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:

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

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

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