# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
590896 | Josia | Paint By Numbers (IOI16_paint) | C++14 | 1 ms | 212 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;
std::string solve_puzzle(std::string s, std::vector<int> c) {
vector<bool> dense;
for (int i: c) {
for (int j = 0; j<i; j++) {
dense.push_back(1);
}
dense.push_back(0);
}
dense.pop_back();
string res;
int wiggle = s.size()-dense.size();
for (int i = 0; i<wiggle; i++) {
res.push_back('?');
}
for (int i = wiggle; i<dense.size(); i++) {
bool both = 0;
for (int j = i-wiggle; j<i; j++) {
if (dense[j] != dense[i]) both = 1;
}
if (both) res.push_back('?');
else {
if (dense[i]) res.push_back('X');
else res.push_back('_');
}
}
for (int i = dense.size(); i<s.size(); i++) {
res.push_back('?');
}
return res;
}
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... |