| Task: | Monikulmio |
| Sender: | sandyy |
| Submission time: | 2025-11-05 18:34:15 +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.00 s | 0 | details |
| #8 | WRONG ANSWER | 0.00 s | 0 | details |
| #9 | WRONG ANSWER | 0.00 s | 0 | details |
| #10 | WRONG ANSWER | 0.01 s | 0 | details |
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);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
input/code.cpp: In function 'void solve()':
input/code.cpp:94:33: warning: 'c2.std::array<int, 2>::_M_elems[0]' may be used uninitialized in this function [-Wmaybe-uninitialized]
94 | if(c2[0]<c1[0]) swap(c1, c2);
| ^~
input/code.cpp:94:33: warning: 'c1.std::array<int...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=105;
int n, m, c, cnt[mxN][mxN];
char grid[mxN][mxN];
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]='\\';
}
}
}
}
// every time you encounter a vertex, search for it and look at the vertices it is connected to
// treat horizontal edges the same way
// if there is one edge going above and one below, treat it as one
// otherwise do not increment cnt
for(int i=1; i<=n; i++) {
int above=0, below=0;
for(int j=1; j<=m; j++) {
cnt[i][j]=cnt[i][j-1];
if(grid[i][j]=='|' || grid[i][j]=='/' || grid[i][j]=='\\') cnt[i][j]++;
if(grid[i][j]=='*') {
ar<int, 2> c1, c2;
for(int k=0; k<c; k++) {
if(corners[k][0]==i && corners[k][1]==j) {
if(k==0) {
c1=corners[c-1];
c2=corners[k+1];
} else if(k==c-1) {
c1=corners[k-1];
c2=corners[0];
} else {
c1=corners[k-1];
c2=corners[k+1];
}
break;
}
}
// let c1 be on the left of the current vertex
if(c2[0]<c1[0]) swap(c1, c2);
if(c1[0]==i && c2[0]==i) continue; // still the same edge
// if they are on different sides of the line
if((c1[0]<i && c2[0]>i) || (c1[0]>i&&c2[0]<i)) cnt[i][j]++;
if(c1[0]!=i && c2[0]==i) {
if(c1[0]>i) below++;
else above++;
}
if(c1[0]==i && c2[0]!=i) {
if(c2[0]>i) {
below++;
} else {
above++;
}
if(below!=above) {
below=0, above=0;
} else {
cnt[i][j]++;
below=0, above=0;
}
}
}
cout << cnt[i][j] << " ";
}
cout << "\n";
}
for(int i=1; i<=n; i++) {
for(int j=1; j<=m; j++) {
if(grid[i][j]=='.') {
if(cnt[i][j]&1) {
cout << '#';
} else cout << grid[i][j];
} else 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: WRONG ANSWER
| input |
|---|
| 8 9 5 5 2 2 5 5 8 7 8 ... |
| correct output |
|---|
| ......... ....*.... .../#\... ../###\.. .*#####*. ... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 2 2 2 2 0 0 1 1 1 1 2 2 2 0 1 1 1 1 1 1 2 2 ... |
Feedback: Incorrect length on line 1: expected 9, got 1
Test 2 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 20 40 4 5 10 5 30 15 30 15 10 |
| correct output |
|---|
| ................................. |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 40, got 1
Test 3 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 20 40 29 8 7 13 2 14 2 9 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 40, got 1
Test 4 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 20 40 14 5 12 5 25 8 28 13 28 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 40, got 1
Test 5 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 20 40 12 3 20 7 16 7 9 11 13 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 40, got 1
Test 6 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 9 35 33 2 3 2 8 4 8 4 5 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 35, got 1
Test 7 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 30 100 69 6 10 6 14 7 14 7 18 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 100, got 1
Test 8 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 40 60 192 11 3 11 5 10 6 11 7 ... |
| correct output |
|---|
| ................................. |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 60, got 1
Test 9 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 50 100 142 1 1 1 7 1 11 1 14 ... |
| correct output |
|---|
| *=====*===*==*................... |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 100, got 1
Test 10 (public)
Verdict: WRONG ANSWER
| input |
|---|
| 100 100 1000 10 1 4 7 1 4 1 9 ... |
| correct output |
|---|
| ...*====*........................ |
| user output |
|---|
| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ... |
Feedback: Incorrect length on line 1: expected 100, got 1
