| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 107116 | tictaccat | Paint By Numbers (IOI16_paint) | C++14 | 3 ms | 384 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) {
int n = s.size(); int k = c.size();
string shortest;
for (int i = 0; i < k; i++) {
if (i != 0) shortest += '_';
for (int j = 0; j < c[i]; j++) shortest += 'X';
}
int minLen = shortest.size();
while (shortest.size() < n) shortest += '_';
//cout << shortest << "\n";
vector<bool> white(n,false), black(n,false);
for (int pos = 0; pos < n; pos++) {
//check white
int j;
for (j = 0; j <= pos+1; j++) {
//if (pos == n-1) cout << shortest[pos-j] << "\n";
if ((j == pos+1 || shortest[pos-j] == '_') && minLen + j <= n) {white[pos] = true; }
if ((j == pos+1 || shortest[pos-j] == 'X') && minLen + j <= n) black[pos] = true;
}
}
string ans = s;
for (int pos = 0; pos < n; pos++) {
assert(white[pos] || black[pos]);
if (white[pos] && black[pos]) ans[pos] = '?';
else if (white[pos]) ans[pos] = '_';
else if (black[pos]) ans[pos] = 'X';
}
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... | ||||
