Submission details
Task:Monikulmio
Sender:sandyy
Submission time:2025-10-28 14:26:20 +0200
Language:C++ (C++17)
Status:READY
Result:73
Feedback
groupverdictscore
#1ACCEPTED73
Test results
testverdicttimescore
#1ACCEPTED0.00 s7details
#2ACCEPTED0.00 s10details
#3ACCEPTED0.00 s7details
#4ACCEPTED0.00 s7details
#5ACCEPTED0.00 s7details
#6ACCEPTED0.00 s7details
#7ACCEPTED0.00 s7details
#8ACCEPTED0.00 s7details
#9ACCEPTED0.00 s7details
#10ACCEPTED0.00 s7details

Compiler report

input/code.cpp: In function 'void setIO(std::string)':
input/code.cpp:6:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    6 |                 freopen((name+".in").c_str(), "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp:7:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |                 freopen((name+".out").c_str(), "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Code

#include<bits/stdc++.h>
using namespace std;
 
void setIO(string name="") {
	if(name.length()) {
		freopen((name+".in").c_str(), "r", stdin);
		freopen((name+".out").c_str(), "w", stdout);
	}
}
 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define debug(x) cout << (x) << "\n"
#define ar array
#define fi first
#define se second
 
const int mxN=101;
int n, m, c;
char grid[mxN][mxN];
 
bool check(int i, int j) {
	return (grid[i][j]=='|' || grid[i][j]=='/' || grid[i][j]=='\\' || grid[i][j]=='*');
}
 
void solve() {
	cin >> n >> m >> c;
	for(int i=1; i<=n; i++) {
		for(int j=1; j<=m; j++) {
			grid[i][j]='.';
		}
	}
	vector<ar<int, 2>> corners(c);
	for(int i=0; i<c; i++) {
		cin >> corners[i][0] >> corners[i][1];
		grid[corners[i][0]][corners[i][1]]='*';
	}
	for(int k=0; k<c; k++) {
		int a = k-1;
		int b = k;
		if(k==0) a = c-1;
		if(corners[a][1]==corners[b][1]) {
			for(int i=min(corners[a][0], corners[b][0])+1; i<max(corners[a][0], corners[b][0]); i++) {
				grid[i][corners[a][1]]='|';
			}
		}
		if(corners[a][0]==corners[b][0]) {
			for(int i=min(corners[a][1], corners[b][1])+1; i<max(corners[b][1], corners[a][1]); i++) {
				grid[corners[a][0]][i]='=';
			}
		}
		if(corners[a][0]!=corners[b][0] && corners[a][1]!=corners[b][1]) {
			if(corners[a][1]>corners[b][1]) swap(a, b);
			if(corners[a][0] > corners[b][0]) {
				for(int i=1; i<=abs(corners[b][1]-corners[a][1])-1; i++) {
					grid[corners[a][0]-i][corners[a][1]+i]='/';
				}
			} else {
				for(int i=1; i<=corners[b][1]-corners[a][1]-1; i++) {
					grid[corners[a][0]+i][corners[a][1]+i]='\\';
				}
			}
		}
	}
	for(int i=1; i<=100; i++) {
		int cnt=0;
		for(int j=1; j<=100; j++) {
			if(grid[i][j]=='.' && cnt%2==1)
				grid[i][j]='#';
			if(grid[i][j]=='*') {
				if(check(i-1, j) || check(i-1, j-1) || check(i-1, j+1) || check(i+1, j) || check(i+1, j+1) || check(i+1, j-1)) cnt++;
			}
			if(grid[i][j]=='|' || grid[i][j]=='/' || grid[i][j]=='\\') {
				cnt++;
			}
		}
	}
	for(int i=1; i<=n; i++) {
		for(int j=1; j<=m; j++) {
			cout << grid[i][j];
		}
		cout << "\n";
	}
}
 
int main() {
	cin.tie(0) -> sync_with_stdio(0);
	//setIO("sleepy");
	int T=1;
	//cin >> T;
	while(T--)
		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
.........
....*####
.../#\...
../###\..
.*#####*.
...

Feedback: Lines are drawn correctly. Incorrect fill character on row 2, col 6: expected '.', got '#'

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
.................................

Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 31: expected '.', got '#'

Test 4 (public)

Verdict: ACCEPTED

input
20 40 14
5 12
5 25
8 28
13 28
...

correct output
.................................

user output
.................................

Feedback: Lines are drawn correctly. Incorrect fill character on row 16, col 26: expected '#', got '.'

Test 5 (public)

Verdict: ACCEPTED

input
20 40 12
3 20
7 16
7 9
11 13
...

correct output
.................................

user output
.................................

Feedback: Lines are drawn correctly. Incorrect fill character on row 3, col 21: expected '.', got '#'

Test 6 (public)

Verdict: ACCEPTED

input
9 35 33
2 3
2 8
4 8
4 5
...

correct output
.................................

user output
.................................

Feedback: Lines are drawn correctly. Incorrect fill character on row 4, col 9: expected '.', got '#'

Test 7 (public)

Verdict: ACCEPTED

input
30 100 69
6 10
6 14
7 14
7 18
...

correct output
.................................

user output
.................................

Feedback: Lines are drawn correctly. Incorrect fill character on row 7, col 19: expected '.', got '#'

Test 8 (public)

Verdict: ACCEPTED

input
40 60 192
11 3
11 5
10 6
11 7
...

correct output
.................................

user output
.................................

Feedback: Lines are drawn correctly. Incorrect fill character on row 2, col 31: expected '.', got '#'

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 2, col 11: 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 2, col 39: expected '.', got '#'