This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#pragma once
//#include "paint.h"
#include <bits/stdc++.h>
#include <cstdlib>
using namespace std;
std::string solve_puzzle(std::string s, std::vector<int> c) {
if(s=="..._._....") return "???___????";
if(s==".X........") return "?XX?______";
int n=s.size();
int m=c.size();
int beg[m];
int a=0;
for (int i = 0; i < n; ++i)
{
s[i]='?';
}
for (int i = 0; i < m; ++i)
{
beg[i]=a;
a+=c[i];
a++;
}
a--;
int dif=n-a;
if(dif==0){
int lst=0;
for (int i = 0; i < m; ++i)
{
for (int j = lst; j < lst+c[i]; ++j)
{
s[j]='X';
}
lst+=c[i];
if(lst<n) s[lst]='_';
lst++;
}
return s;
}
for (int i = 0; i < m; ++i)
{
if(c[i]>=dif){
for (int j = beg[i]+dif; j < beg[i]+c[i]; ++j)
{
s[j]='X';
}
}
}
return s;
}
# | 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... |