# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1035915 | baldwinhuang1 | Paint By Numbers (IOI16_paint) | C++14 | 0 ms | 348 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.
#include "paint.h"
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
string solve_puzzle(string s, vector<int> c) {
vector<int> start(c.size(), 0);
for (int i = 1; i < c.size(); i++) {
start[i] = start[i - 1] + 1 + c[i - 1];
}
vector<int> end(c.size(), s.size() - 1);
for (int i = c.size() - 2; i >= 0; i--) {
end[i] = end[i + 1] - 1 - c[i + 1];
}
string ans = s;
for (int i = 0; i < c.size(); i++) {
string a = s;
string b = s;
for (int j = start[i]; j <= (start[i] + c[i] - 1); j++) {
a[j] = 'X';
}
for (int j = end[i]; j >= (end[i] - c[i] + 1); j--) {
b[j] = 'X';
}
for (int j = start[i]; j < end[i]; j++) {
ans[j] = '?';
}
for (int j = start[i]; j < end[i]; j++) {
if (a[j] == 'X' && b[j] == 'X') {
ans[j] = 'X';
}
}
// cout << start[i] << ' ' << end[i] << '\n';
// cout << a << '\n' << b << '\n';
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |