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"
//#define int long long
#define pi pair<int, int>
#define pii pair<int, pi>
#define fi first
#define se second
#ifdef _WIN32
#define getchar_unlocked _getchar_nolock
#endif
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
int P[300005], S[300005];
std::string solve_puzzle(std::string s, std::vector<int> c) {
int n = (int)s.length(), k = (int)c.size();
for(int i=1;i<=k;i++)P[i] = P[i-1] + c[i-1] + 1;
S[k+1] = P[0] = 0;
string ans;
for(int i=k;i>=1;i--)S[i] = S[i+1] + c[i-1] + 1;
for(int i=0;i<n;i++){
bool f = 0;
for(int j=0;j<=k;j++)if(P[j] - 1 <= i && S[j+1] - 1 <= (n - i - 1))f = 1;
bool f2 = 0;
int cur = 0;
for(int j=0;j<k;j++){
if(cur < i + 1 && cur + c[j] >= i + 1)f2 = 1;
cur += c[j] + 1;
}
if(P[k] - 1 != n)f2 = 1;
//cout << f << ' ' << f2 << '\n';
if(f && f2)ans += "?";
else if(f)ans += "_";
else ans += "X";
}
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... |