# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
438746 | SorahISA | Bold (COCI21_bold) | C++17 | 1 ms | 308 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// #pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
using pii = pair<int, int>;
template<typename T>
using Prior = std::priority_queue<T>;
template<typename T>
using prior = std::priority_queue<T, vector<T>, greater<T>>;
#define X first
#define Y second
#define eb emplace_back
#define ALL(x) begin(x), end(x)
#define RALL(x) rbegin(x), rend(x)
#define fastIO() ios_base::sync_with_stdio(0), cin.tie(0)
template<class T>
ostream& operator << (ostream &os, vector<T> vec) {
for (int i = 0; i < vec.size(); ++i) {
if (i) os << "\n";
os << vec[i];
}
return os;
}
void solve() {
int n, m; cin >> n >> m;
vector<string> mp(n);
for (auto &str : mp) cin >> str;
for (int i = n-1; i >= 0; --i) {
for (int j = m-1; j >= 0; --j) {
if ((mp[i][j] == '#') or
(i and mp[i-1][j] == '#') or
(j and mp[i][j-1] == '#') or
(i and j and mp[i-1][j-1] == '#')) {
mp[i][j] = '#';
}
else {
mp[i][j] = '.';
}
}
}
cout << mp << "\n";
}
int32_t main() {
fastIO();
int t = 1; // cin >> t;
while (t--) solve();
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |