# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
607563 | gonzakia29 | Paint By Numbers (IOI16_paint) | C++17 | 0 ms | 0 KiB |
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 <vector>
#include <string>
#include <cstdio>
#include <cassert>
const int S_MAX_LEN = 200 * 1000;
char buf[S_MAX_LEN + 1];
using namespace std;
string solve_puzzle(string s, vector<int> c) {
string salida = "";
int sizes = s.size();
int k = c.size();
int dif = sizes-(k-1);
for (int i = 0; i < k; ++i){
dif -= c[i];
}
if (dif != 0){
int counter = 0;
for (int i = 0; i < k; ++i){
for (int j = 0; j < c[i]; ++j){
if (j>=dif){
salida += "X";
counter++;
} else{
salida += "?";
counter++;
}
}
salida += "?";
counter++;
}
for (int i = 0; i < sizes-counter;++i){
salida+= "?";
}
} else{
for (int i = 0; i < k; ++i){
for (int j = 0; j < c[i]; ++j){
salida += "X";
}
if (i != k-1){
salida += "_";
}
}
}
return salida;
}