#include <bits/stdc++.h>
//#include "paint.h"
using namespace std;
#define ll long long
#define vb vector<bool>
#define pb push_back
#define ff(aa, bb, cc) for(ll aa = bb; aa < cc; aa++)
#define vl vector<ll>
#define pll pair<ll, ll>
#define fi first
#define se second
#define ed "\n"
#define all(aaa) aaa.begin(), aaa.end()
#define rall(aaa) aaa.rbegin(), aaa.rend()
ll MOD = 1e9+7;
std::string solve_puzzle(std::string s, std::vector<int> c){
ll n = s.size();
ll tamano = c.size()-1;
ff(i, 0, c.size()){
tamano += c[i];
}
ll vacio = n-tamano, prev = 0;
vb x(n, false), maybe(n, false);
ff(i, 0, c.size()){
cout << prev << ed;
ff(j, prev+vacio, prev+c[i]){
x[j] = true;
}
ff(j, prev, prev+c[i]+vacio){
maybe[j] = true;
}
prev += c[i]+1;
}
string ans = "";
/*ff(i, 0, n){
cout << maybe[i] << " " << x[i] << ed;
}
cout << ed;*/
ff(i, 0, n){
if(x[i]){
ans += 'X';
}
else if(maybe[i]){
ans += '?';
}
else{
ans += '_';
}
}
return ans;
}
/*
const int S_MAX_LEN = 200 * 1000;
char buf[S_MAX_LEN + 1];
int main() {
assert(1 == scanf("%s", buf));
std::string s = buf;
int c_len;
assert(1 == scanf("%d", &c_len));
std::vector<int> c(c_len);
for (int i = 0; i < c_len; i++) {
assert(1 == scanf("%d", &c[i]));
}
std::string ans = solve_puzzle(s, c);
printf("%s\n", ans.data());
return 0;
}
*/
Compilation message (stderr)
paint.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
paint_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | 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... |