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 <cstdlib>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
std::string solve_puzzle(std::string s, std::vector<int> c) {
int n=s.length();
int m=c.size();
int val=0;
for(int i=0;i<m;i++)
{
val=val+c[i]+1;
}
val=val-1;
string arr[n-val+1];
for(int i=0;i<n-val+1;i++)
{
arr[i]=s;
for(int j=0;j<n;j++)
{
arr[i][j]='_';
}
}
for(int i=0;i<n-val+1;i++)
{
int pos=i;
int j=0;
while(j<m)
{
for(int k=0;k<c[j];k++)
{
arr[i][pos]='X';
pos++;
}
j++;
if(j!=m)
{
pos++;
}
}
}
for(int j=0;j<n;j++)
{
bool chek=true;
for(int i=0;i<n-val+1;i++)
{
if(arr[0][j]!=arr[i][j]) chek=false;
}
if(chek==true)
{
s[j]=arr[0][j];
}
else
{
s[j]='?';
}
}
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... |