This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// c4ts0up
// Alvaro Bacca - COL3
#include "paint.h"
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
int n, k;
vector <int> ps;
vector <int> ade, atr;
string cad;
// encuentra la interseccion de [a] union [b]. devuelve {-1,-1} si no hay
pair <int,int> interseccion(pair <int,int> a, pair <int,int> b) {
    pair <int,int> res = {b.ff, a.ss};
    if (b.ff > a.ss) return {-1,-1};
    else return res;
}
string solve_puzzle(string s, vector<int> c) {
    n = c.size();
    k = s.size();
    
    // llenamos el de adelante
    for (int i=0; i<n; i++) {
        for (int j=0; j<c[i]; j++) ade.pb(i+1);
        if (ade.size()+1 <= k) ade.pb(-(i+1));
    }
    while (ade.size() < k) ade.pb(-n);
    // llenamos el reverso
    for (int i=n-1; i>=0; i--) {
        for (int j=0; j<c[i]; j++) atr.pb(i+1);
        if (atr.size()+1 <= k && i>0) atr.pb(-(i));
    }
    while (atr.size() < k) atr.pb(-n);
    reverse(atr.begin(), atr.end());
    //*//
    cout << "ade := ";
    for (int x : ade) cout << x << ", ";
    cout << endl;
    cout << "atr := ";
    for (int x : atr) cout << x << ", ";
    cout << endl;
    //*/
    // crea la cadena
    for (int i=0; i<k; i++) {
        if (ade[i] == atr[i]) cad += (ade[i] > 0 ? "X" : "_");
        else cad += "?";
    }
    return cad;
}
Compilation message (stderr)
paint.cpp: In function 'std::string solve_puzzle(std::string, std::vector<int>)':
paint.cpp:30:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |         if (ade.size()+1 <= k) ade.pb(-(i+1));
      |             ~~~~~~~~~~~~~^~~~
paint.cpp:32:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |     while (ade.size() < k) ade.pb(-n);
      |            ~~~~~~~~~~~^~~
paint.cpp:37:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |         if (atr.size()+1 <= k && i>0) atr.pb(-(i));
      |             ~~~~~~~~~~~~~^~~~
paint.cpp:39:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |     while (atr.size() < k) atr.pb(-n);
      |            ~~~~~~~~~~~^~~| # | 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... |