| Task: | Ruudukko |
| Sender: | jusola |
| Submission time: | 2019-10-01 18:36:42 +0300 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | details |
| #2 | ACCEPTED | 0.01 s | details |
| #3 | WRONG ANSWER | 0.01 s | details |
| #4 | WRONG ANSWER | 0.01 s | details |
| #5 | WRONG ANSWER | 0.02 s | details |
| #6 | WRONG ANSWER | 0.02 s | details |
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 |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 2 |
| correct output |
|---|
| 1 2 2 1 |
| user output |
|---|
| 1 2 2 1 |
Test 3
Verdict: WRONG ANSWER
| 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: WRONG ANSWER
| 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... Truncated |
Test 5
Verdict: WRONG ANSWER
| 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... Truncated |
Test 6
Verdict: WRONG ANSWER
| 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... Truncated |
