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;
#define sz size()
bool vis[105][2];
string solve_puzzle(string s, vector<int> c) {
int n = (int)s.sz;
int k = (int)c.sz;
int k1 = k;
int sum = 0;
for (int i : c) {
sum += i;
}
int l = 0;
for (int i = 0; i < k1; ++i) {
int val = n - (sum + k - 1);
int val1 = n - (sum + k - 1) + c[i];
// cout << n << " " << k << " " << sum << " " << val << " " << val1 << " " << c[i] << " " << i << " " << l << "\n";
for (int j = l; j <= l + val - 1; ++j) {
vis[j][0] = 1;
}
int jj = 0;
if (i > 0) jj = 1;
for (int j = l + jj; j <= l + val1 - 1; ++j) {
vis[j][1] = 1;
}
l += c[i];
n -= c[i];
sum -= c[i];
k--;
}
n = (int)s.sz;
while (l+1 < n) {
l++;
vis[l][0] = 1;
}
// cout << n;
// exit(0);
string jog;
for (int i = 0; i < n; ++i) {
if (vis[i][0] and vis[i][1]) {
jog += '?';
}
else if (vis[i][0]) jog += '_';
else if (vis[i][1]) jog += 'X';
}
// cout << (int)jog.sz << "\n";
// cout << jog;
// exit(0);
return jog;
}
# | 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... |