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>
using namespace std;
#include "paint.h"
string solve_puzzle(string s, vector<int> c)
{
int n = s.size(), k = c.size();
string res(n, '?');
int sum_l = 0, sum_r = 0;
for (int i = 0; i < k; i++)
sum_r += c[i];
for (int i = 0; i < k; i++)
{
sum_r -= c[i];
int L_dist = sum_l + i;
int R_dist = sum_r + k - 1 - i;
if (L_dist + R_dist >= n)
continue;
for (int j = n - R_dist - c[i]; j < L_dist + c[i]; j++)
res[j] = 'X';
sum_l += c[i];
}
if (sum_l + k - 1 == n)
{
for (int i = 0; i < n; i++)
if (res[i] == '?')
res[i] = '_';
}
return res;
}
# | 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... |