| Task: | Monikulmio |
| Sender: | xheater |
| Submission time: | 2025-11-04 19:06:48 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 94 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 94 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | 10 | details |
| #2 | ACCEPTED | 0.00 s | 10 | details |
| #3 | ACCEPTED | 0.00 s | 10 | details |
| #4 | ACCEPTED | 0.00 s | 10 | details |
| #5 | ACCEPTED | 0.00 s | 10 | details |
| #6 | ACCEPTED | 0.00 s | 10 | details |
| #7 | ACCEPTED | 0.00 s | 10 | details |
| #8 | ACCEPTED | 0.00 s | 10 | details |
| #9 | ACCEPTED | 0.00 s | 7 | details |
| #10 | ACCEPTED | 0.01 s | 7 | details |
Compiler report
input/code.cpp: In function 'void spread(int, int, std::vector<std::vector<int> >&)':
input/code.cpp:38:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | if(X > -1 && X < grid.size() && Y > -1 && Y < grid[0].size()){
| ~~^~~~~~~~~~~~~
input/code.cpp:38:53: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | if(X > -1 && X < grid.size() && Y > -1 && Y < grid[0].size()){
| ~~^~~~~~~~~~~~~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:115:10: warning: unused variable 'cheese' [-Wunused-variable]
115 | bool cheese = true;
| ^~~~~~Code
#include <iostream>
#include <array>
#include <vector>
using namespace std;
void table(int cell){
switch (cell)
{
case 1:
cout << '*';
break;
case 2:
cout << '=';
break;
case 3:
cout << '/';
break;
case 4:
cout << '\\';
break;
case 5:
cout << '|';
break;
case 6:
cout << '.';
break;
default:
cout << '#';
break;
}
}
void spread(int x, int y, vector<vector<int>>&grid){
vector<pair<int, int>>dirs = {{0,1},{1,0},{-1,0},{0,-1}};
for(auto dir : dirs){
int X = x + dir.first;
int Y = y + dir.second;
if(X > -1 && X < grid.size() && Y > -1 && Y < grid[0].size()){
if(grid[X][Y] == 0){
grid[X][Y] = 6;
spread(X, Y, grid);
}
}
}
}
int main(){
//n korkeus
//m leveys
int m, n, k;
cin >> n >> m >> k;
cout << char(10);
pair<int, int>point[k] = {};
vector<vector<int>> grid(m + 2, vector<int>(n + 2));
for(int i = 0; i < k; i++){
int y, x;
cin >> y >> x;
point[i] = {x, y};
grid[x][y] = 1;
}
for (int i = 0; i < k; i++){
pair<int, int> current = point[i];
pair<int, int> next = point[(i+1)%k];
int deltaX = next.first - current.first;
int deltaY = next.second - current.second;
int unitDir[2] = {};
int type;
if(deltaX > 0){
unitDir[0] = 1;
if(deltaY > 0){
unitDir[1] = 1;
type = 4;
}else if(deltaY < 0){
unitDir[1] = -1;
type = 3;
}else{
unitDir[1] = 0;
type = 2;
}
}else if(deltaX < 0){
unitDir[0] = -1;
if(deltaY > 0){
unitDir[1] = 1;
type = 3;
}else if(deltaY < 0){
unitDir[1] = -1;
type = 4;
}else{
unitDir[1] = 0;
type = 2;
}
}else if(deltaX == 0){
unitDir[0] = 0;
if(deltaY > 0){
unitDir[1] = 1;
type = 5;
}else if(deltaY < 0){
unitDir[1] = -1;
type = 5;
}
}
pair<int, int>last = current;
while (last != next){
last.first += unitDir[0];
last.second += unitDir[1];
if(last == next){
break;
}
grid[last.first][last.second] = type;
}
}
// print grid
spread(0, 0, grid);
bool cheese = true;
for(int i = 1; i < n + 1; i++){
for(int j = 1; j < m +1; j++){
table(grid[j][i]);
}
cout << char(10);
}
return 0;
}Test details
Test 1 (public)
Verdict: ACCEPTED
| input |
|---|
| 8 9 5 5 2 2 5 5 8 7 8 ... |
| correct output |
|---|
| ......... ....*.... .../#\... ../###\.. .*#####*. ... |
| user output |
|---|
......... ....*.... .../#\... ../###\.. ... |
Test 2 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 4 5 10 5 30 15 30 15 10 |
| correct output |
|---|
| ................................. |
| user output |
|---|
................................. |
Test 3 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 29 8 7 13 2 14 2 9 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
................................. |
Test 4 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 14 5 12 5 25 8 28 13 28 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
................................. |
Test 5 (public)
Verdict: ACCEPTED
| input |
|---|
| 20 40 12 3 20 7 16 7 9 11 13 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
................................. |
Test 6 (public)
Verdict: ACCEPTED
| input |
|---|
| 9 35 33 2 3 2 8 4 8 4 5 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
................................. |
Test 7 (public)
Verdict: ACCEPTED
| input |
|---|
| 30 100 69 6 10 6 14 7 14 7 18 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
................................. |
Test 8 (public)
Verdict: ACCEPTED
| input |
|---|
| 40 60 192 11 3 11 5 10 6 11 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
................................. |
Test 9 (public)
Verdict: ACCEPTED
| input |
|---|
| 50 100 142 1 1 1 7 1 11 1 14 ... |
| correct output |
|---|
| *=====*===*==*................... |
| user output |
|---|
*=====*===*==*................... |
Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 9: expected '.', got '#'
Test 10 (public)
Verdict: ACCEPTED
| input |
|---|
| 100 100 1000 10 1 4 7 1 4 1 9 ... |
| correct output |
|---|
| ...*====*........................ |
| user output |
|---|
...*====*........................ |
Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 29: expected '.', got '#'
