# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
773420 | Jomnoi | Paint By Numbers (IOI16_paint) | C++17 | 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 <bits/stdc++.h>
#include "paint.h"
using namespace std;
const int MAX_N = 2e5 + 5;
int qs[MAX_N];
string ans;
string solve_puzzle(string s, vector <int> c) {
int N = s.size(), k = c.size();
for (int i = 0; i < k; i++) {
for (int j = 0; j < c[i]; j++) ans.push_back('X');
if (i < k - 1) ans.push_back('_');
}
while (ans.size() < N) ans.push_back('_');
for (int i = 1; i <= k; i++) qs[i] = qs[i - 1] + c[i - 1];
for (int i = 1; i <= k; i++) {
int l = qs[i - 1] + i;
int r = N - (qs[k] - qs[i]) - (k - i);
for (int j = l; j < r - c[i - 1] + 1; j++) ans[j - 1] = '?';
for (int j = l + c[i - 1]; j <= r; j++) ans[j - 1] = '?';
// for (int j = r - c[i - 1] + 1; j <= l + c[i - 1] - 1; j++) ans[j - 1] = '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... |