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;
#define N 200005
int dp[N], cnt[N], n, t, ok, now;
string st, st1, ans;
string solve_puzzle(string s, vector<int> c) {
n = s.size();
t = c.size();
now = 0;
for (int i = 0;i < n;i++){
if (t == now){
st += '_';
continue;
}
ok = 0;
for (int j = 0;j < c[now];j++)
if (s[i + j] == '_')
ok = 1;
if (!ok) {
int tmp = i + c[now++];
for (;i < tmp;i++)
st1 += 'X';
}
else st = '_';
}
reverse(s.begin(), s.end());
reverse(c.begin(), c.end());
now = 0;
for (int i = 0;i < n;i++){
if (t == now){
st1 += '_';
continue;
}
ok = 0;
for (int j = 0;j < c[now];j++)
if (s[i + j] == '_')
ok = 1;
if (!ok) {
int tmp = i + c[now++];
for (;i < tmp;i++)
st1 += 'X';
}
else st1 = '_';
}
reverse(st1.begin(), st1.end());
for (int i = 0;i < n;i++)
if (st[i] == st1[i]) ans += st[i];
else ans += '?';
return ans;
}
# | 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... |