| Task: | Monikulmio |
| Sender: | Interaalimato |
| Submission time: | 2025-11-01 15:55:52 +0200 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 100 |
| 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 | ACCEPTED | 0.00 s | 10 | details |
Code
#include <bits/stdc++.h>
using namespace std;
// read from file instead of console:
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
const int M = 1000000007;
typedef long long ll;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef stack<int> si;
typedef priority_queue<int> pqi;
typedef deque<int> dqi;
typedef unordered_set<int> seti;
typedef unordered_map<int,int> mapi;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<vector<long long>>> vvvll;
typedef pair<long long, long long> pll;
typedef queue<long long> qll;
typedef stack<long long> sll;
typedef priority_queue<long long> pqll;
typedef deque<long long> dqll;
typedef unordered_set<long long> setll;
#define loop(i, a, b) for (int i = a; i < b; i++)
#define rloop(i, a, b) for (int i = a; i > b; i--)
#define each(a, c) for (auto a : c)
#define all(x) x.begin(), x.end()
#define PI M_PI
#define PB push_back
#define P push
#define POB pop_back
#define F first
#define S second
#define sz size()
#define R1(a) int a; cin >> a
#define R2(a, b) int a,b; cin >> a >> b
#define R3(a, b, c) int a,b,c; cin >> a >> b >> c
#define R4(a, b, c, d) int a,b,c,d; cin >> a >> b >> c >> d
#define WS(a) cout << a << " "
#define WN(a) cout << a << "\n"
#define WNL cout << "\n"
vector<string> res;
// y, x
int stupid[101][101];
pair<pi,pi> ngs[1010];
int n,m,k;
void fill_row(int i){
bool in = 0;
loop(j,0,m){
char c = res[i].at(j);
if(c == '|' || c == '/' || c == '\\') in = !in;
else if(c == '*'){
int idx = stupid[i+1][j+1];
int pr = ngs[idx].F.F-1;
int ns = ngs[idx].S.F-1;
if(ns > i) in = !in;
if(pr > i) in = !in;
}
if(res[i][j] == '.') res[i][j] = (in?'#':'.');
}
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m >> k;
res = vector<string>(n, string(m,'.'));
pi pr;
pi fs;
loop(i,0,k+1){
pi cu;
if(i < k){
R2(a,b);
cu = {a,b};
stupid[a][b] = i;
if(i == 0) fs = cu;
}
else cu = fs;
if(i > 0){
ngs[i%k].F = pr;
ngs[(i-1)].S = cu;
int y1 = pr.F - 1;
int x1 = pr.S - 1;
int dx = cu.S - pr.S;
int dy = cu.F - pr.F;
char ch = '\\';
if(dx == 0) ch = '|';
else if(dy == 0) ch = '=';
else if((dx > 0) ^ (dy > 0)) ch = '/';
int ct = max(abs(dy), abs(dx));
dx /= ct;
dy /= ct;
loop(j,1,ct){
res[y1 + dy*j][x1 + dx*j] = ch;
}
res[y1][x1] = '*';
}
pr = cu;
}
loop(i,0,n-1){
fill_row(i);
}
loop(i,0,n){
cout << res[i] << "\n";
}
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 |
|---|
| ...*====*........................ |
