CSES - Datatähti 2021 alku - Results
Submission details
Task:Ratsun reitit
Sender:Kemil
Submission time:2020-10-01 13:31:04 +0300
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:24:22: error: expected ';' before numeric constant
   for (int i = 0; i  4; i++)
                      ^
input/code.cpp:24:22: warning: for increment expression has no effect [-Wunused-value]
input/code.cpp:24:23: error: expected ')' before ';' token
   for (int i = 0; i  4; i++)
                       ^
input/code.cpp:24:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   for (int i = 0; i  4; i++)
   ^~~
input/code.cpp:24:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   for (int i = 0; i  4; i++)
                         ^
input/code.cpp:24:25: error: 'i' was not declared in this scope
input/code.cpp:18:7: warning: unused variable 'Case4' [-Wunused-variable]
   int Case4[4][4] = {
       ^~~~~
input/code.cpp:35:22: error: expected ';' before numeric constant
   for (int j = 0; j  5; j++)
                      ^
input/code.cpp:35:22: warnin...

Code

#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int Grid[100][100];
int Base[5][5] =
{
{0,3,2,3,2},
{3,4,1,2,3},
{2,1,4,3,2},
{3,2,3,2,3},
{2,3,2,3,4}
};
if (n == 4)
{
int Case4[4][4] = {
{0, 3, 2, 5},
{3, 4, 1, 2},
{2, 1, 4, 3},
{5, 2, 3, 2}
};
for (int i = 0; i 4; i++)
{
for (int j = 0; j 4; j++)
{
cout << Case4[i][j];
}
cout << endl;
}
}
else
{
for (int j = 0; j 5; j++)
{
for (int k = 0; k 5; k++)
{
Grid[j][k] = Base[j][k];
}
}
for (int y = 5; y n; y++)
{
Grid[y][0] = Grid[y - 2][1] + 1;
Grid[0][y] = Grid[1][y - 2] + 1;
for (int x = 1; x = y; x++)
{
Grid[y][x] = Grid[y - 2][x - 1] + 1;
Grid[x][y] = Grid[y - 2][x - 1] + 1;
}
}
for (int i = 0; i n; i++)
{
for (int j = 0; j n; j++)
{
cout << Grid[i][j];
}
cout << endl;
}
}
}