| Task: | Monikulmio |
| Sender: | manttila |
| Submission time: | 2025-11-03 09:39:13 +0200 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 97 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 97 |
| 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.01 s | 10 | details |
| #10 | ACCEPTED | 0.00 s | 7 | details |
Code
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cout << #x << " = " << x << "\n";
typedef long long ll;
#define fi first
#define se second
#define p g[i][j]
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
const ll M = 1000000007;
int n,m;
vector<pi> node(1001);
char g[101][101];
int d[101][101];
void add(int x1, int y1, int x2, int y2){
if(y1>y2){
d[y1][x1]++;
d[y2][x2]++;
}
if(y1<y2){
d[y1][x1]--;
d[y2][x2]--;
}
if(x1 == x2){ // same x -> |
int dv = abs(y1-y2)/(y1-y2);
while(y2 != y1){
y2+=dv;
g[y2][x1] = '|';
if(y2+dv == y1) break;
}
}
else if(y1 == y2){ // same y -> =
int dv = abs(x1-x2)/(x1-x2);
while(x2 != x1){
x2+=dv;
g[y1][x2] = '=';
if(x2+dv == x1) break;
}
}
else if((x2 > x1 && y2 < y1) || (x2 < x1 && y2 > y1)){ // -> /
int dv = abs(x1-x2)/(x1-x2);
while(x2 != x1){
x2+=dv; y2-=dv;
g[y2][x2] = '/';
if(x2+dv == x1) break;
}
}
else{
int dvx = abs(x1-x2)/(x1-x2);
int dvy = abs(y1-y2)/(y1-y2);
while(x2 != x1){
x2+=dvx; y2+=dvy;
g[y2][x2] = '\\';
if(x2+dvx == x1) break;
}
}
}
void solve(){
int k; cin >> n >> m >> k;
for(int i=0; i<n; i++){
for(int j=0; j<m; j++) g[i][j] = '.';
}
for(int i=0,a,b; i<k; i++){
cin >> a >> b; a--; b--;
node[i] = {a,b};
g[a][b] = '*';
}
set<pair<int,int>> sp;
for(int i=1; i<k; i++){
add(node[i].se, node[i].fi, node[i-1].se, node[i-1].fi);
}
add(node[0].se, node[0].fi, node[k-1].se, node[k-1].fi);
for(int i=0,x,y; i<k; i++){
y=node[i].fi; x=node[i].se;
g[y][x] = '*';
}
for(int i=0; i<n; i++){
int tick=0;
for(int j=0; j<m; j++){
if(p=='|' || p=='/' || p=='\\'){
tick++; continue;
}
if(p=='*' || p=='='){
int deriv = d[i][j];
if(abs(deriv)==2){tick++; continue;};
while(g[i][j+1]=='*' || g[i][j+1]=='='){
j++;
if(deriv+d[i][j]==0) break;
if(abs(deriv+d[i][j])==2) break;
}
if(deriv+d[i][j]==0){
continue;
}
else{tick++;}
}
if(tick%2==1 && g[i][j]=='.') p='#';
}
}
for(int i=0; i<n; i++){
int j=m-1;
while(p=='#'){
p='.'; j--;
}
}
for(int i=0; i<n; i++){
for(int j=0; j<m; j++) cout << g[i][j];
cout << "\n";
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
solve();
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 |
|---|
| *=====*===*==*................... |
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 34, col 55: expected '.', got '#'
