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 <bits/stdc++.h>
using namespace std;
int N, M;
string solve_puzzle(string s, vector<int> c)
{
N = s.size();
M = c.size();
vector<int> preSum(M + 1);
vector<int> sufSum(M + 1, N);
for (int i = 0; i < M; i++)
preSum[i+1] = preSum[i] + c[i] + 1;
for (int i = M - 1; i >= 0; i--)
sufSum[i] -= (N - sufSum[i+1]) + c[i] + (int)(i != M - 1);
string res(N, '?');
for (int i = 0; i < M; i++)
{
for (int j = sufSum[i]; j < preSum[i] + c[i]; j++)
res[j] = 'X';
}
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... |