| Task: | Monikulmio |
| Sender: | zli0122 |
| Submission time: | 2025-10-27 15:05:59 +0200 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 90 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 90 |
| 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 | 10 | details |
| #10 | RUNTIME ERROR | 0.00 s | 0 | details |
Code
#include <bits/stdc++.h>
#define debug(x) cout << #x << ": " << (x) << endl
using namespace std;
const int N=111, M=111;
const string ascii_char = ".#**=| / \\";
int sign(int x) {
return((x>0)-(x<0));
}
void solve() {
int n, m, k;
cin >> n >> m >> k;
int grid[N][M];
deque<int> r_seq, c_seq;
int r, c;
for (int _=0; _<k; _++) {
cin >> r >> c;
r_seq.push_front(r-1);
c_seq.push_front(c-1);
}
deque<int> dr_seq, dc_seq;
for (int _=0; _<k; _++) {
dr_seq.push_front(sign(r_seq.back()-r_seq.front()));
dc_seq.push_front(sign(c_seq.back()-c_seq.front()));
r_seq.push_front(r_seq.back()); r_seq.pop_back();
c_seq.push_front(c_seq.back()); c_seq.pop_back();
}
deque<int> vt_seq;
for (int _=0; _<k; _++) {
if ((dr_seq.back()==0) && (dr_seq.front()==0)) vt_seq.push_front(2); //horizontal
else if (dr_seq.back() == dr_seq.front()) vt_seq.push_front(3); //vertical
else if (dr_seq.back() == -dr_seq.front()) vt_seq.push_front(2); //lonely
else if ((dr_seq.back() - dr_seq.front()) == -1) vt_seq.push_front(3); //edgecase
else vt_seq.push_front(2); //other edgecase
dr_seq.push_front(dr_seq.back()); dr_seq.pop_back();
dc_seq.push_front(dc_seq.back()); dc_seq.pop_back();
}
vt_seq.push_front(vt_seq.back()); vt_seq.pop_back(); // step once
//for (auto i : dr_seq) cout << i; cout << "\n";
// for node <seq front>, its two directions are <dseq front> (corresponding to previous) and <dseq back> (corresponding to next).
for (int _=0; _<k; _++) {
r = r_seq.front();
c = c_seq.front();
int dr = dr_seq.back();
int dc = dc_seq.back();
grid[r][c] = vt_seq.front();
r += dr;
c += dc;
while (r != r_seq.back() || c != c_seq.back()) {
if (dr == 0) grid[r][c] = 4;//=
if (dc == 0) grid[r][c] = 5;//|
if (dc == -dr) grid[r][c] = 7;///
if (dc == dr) grid[r][c] = 9;//backslash
r += dr;
c += dc;
}
vt_seq.push_front(vt_seq.back()); vt_seq.pop_back();
r_seq.push_front(r_seq.back()); r_seq.pop_back();
c_seq.push_front(c_seq.back()); c_seq.pop_back();
dr_seq.push_front(dr_seq.back()); dr_seq.pop_back();
dc_seq.push_front(dc_seq.back()); dc_seq.pop_back();
}
int counter;
for (int r=0; r<n; r++) {
counter = 0;
for (int c=0; c<m; c++) {
if (grid[r][c] == 0) {
cout << ascii_char[counter%2];
} else {
cout << ascii_char[grid[r][c]];
counter += grid[r][c];
}
}
cout << "\n";
}
}
int main() {
cin.tie(0) -> ios::sync_with_stdio(0);
solve();
}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: RUNTIME ERROR
| input |
|---|
| 100 100 1000 10 1 4 7 1 4 1 9 ... |
| correct output |
|---|
| ...*====*........................ |
| user output |
|---|
| ...*====*........................ |
