| Task: | Monikulmio |
| Sender: | R0B0R0BO |
| Submission time: | 2025-10-28 16:41:26 +0200 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| test | verdict | time | score | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.00 s | 0 | details |
| #2 | WRONG ANSWER | 0.00 s | 0 | details |
| #3 | WRONG ANSWER | 0.00 s | 0 | details |
| #4 | WRONG ANSWER | 0.00 s | 0 | details |
| #5 | WRONG ANSWER | 0.00 s | 0 | details |
| #6 | WRONG ANSWER | 0.00 s | 0 | details |
| #7 | WRONG ANSWER | 0.01 s | 0 | details |
| #8 | WRONG ANSWER | 0.00 s | 0 | details |
| #9 | WRONG ANSWER | 0.01 s | 0 | details |
| #10 | WRONG ANSWER | 0.01 s | 0 | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:52:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
52 | for (int i = 0; i < pisteet.size(); i++)
| ~~^~~~~~~~~~~~~~~~
input/code.cpp:55:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
55 | if(i == pisteet.size()-1){ continue;}
| ~~^~~~~~~~~~~~~~~~~~~Code
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <optional>
typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned int uint;
using namespace std;
int main(){
int n = 0;
int m = 0;
int k = 0;
cin >> n;
cin >> m;
cin >> k;
vector<pair<int,int>> pisteet;
map<pair<int,int>,char> piiros;
for (int i = 0; i < k; i++)
{
int x,y = 0;
cin >> y >> x;
pisteet.push_back(make_pair(x,y));
}
pisteet.push_back(pisteet[0]); // Tämä, jotta viimeisen pisteen saa kivasti yhistettyä ensimmäiseen
for (int y = 1; y <= n + 1; y++)
{
for (int x = 1; x <= m + 1; x++)
{
piiros[make_pair(x,y)] = 46; // .
}
}
for (int i = 0; i < pisteet.size(); i++)
{
piiros[pisteet[i]] = 42; //*
if(i == pisteet.size()-1){ continue;}
//= eli jos y ovat samat
if(pisteet[i].second == pisteet[i+1].second){
int ero = 1;
if(signbit(pisteet[i].first - pisteet[i+1].first)){
ero = -1;
}
auto mato = pisteet[i+1];
for (int j = 0; j < m; j++)
{
mato.first += ero;
if(mato==pisteet[i]) break;
piiros[mato] = 61; //=
}
}
//| eli jos x ovat samat
//= eli jos y ovat samat
else if(pisteet[i].first == pisteet[i+1].first){
int ero = 1;
if(signbit(pisteet[i].second - pisteet[i+1].second)){
ero = -1;
}
auto mato = pisteet[i+1];
for (int j = 0; j < m; j++)
{
mato.second += ero;
if(mato==pisteet[i]) break;
piiros[mato] = 124; //|
}
}
else{
int yEro = 1;
if(signbit(pisteet[i].second - pisteet[i+1].second)){
yEro = -1;
}
int xEro = 1;
if(signbit(pisteet[i].first - pisteet[i+1].first)){
xEro = -1;
}
auto mato = pisteet[i+1];
for (int j = 0; j < m; j++)
{
mato.second += yEro;
mato.first += xEro;
if(mato==pisteet[i]) break;
if(signbit(yEro * xEro)){
piiros[mato] = 47; // "/"
}
else{
piiros[mato] = 92; // "\"
}
}
}
}
// piiros[make_pair(1,1)] = 43;
for (int y = 0; y < n + 1; y++)
{
for (int x = 0; x < m + 1; x++)
{
cout << piiros[make_pair(x,y)];
}
cout << "\n";
}
return 0;
}