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 <bits/stdc++.h>
using namespace std;
struct range
{
int L,R;
};
string solve_puzzle(string s, vector<int> clues) {
int k=clues.size();
vector<range> ranges(k+1);
string ans=s;
int act=0;
for(int i=0;i<k;i++){
ranges[i].L=act;
act+=clues[i]+1;
}
act=0;
int n=s.size();
for(int i=k-1;i>=0;i--){
ranges[i].R=n-act;
ranges[i].R--;
act+=clues[i]+1;
}
for(int i=0;i<k;i++){
int m=ranges[i].R-ranges[i].L+1;
//cout<<ranges[i].L<<" "<<ranges[i].R<<endl;
for(int j=0;j<m;j++){
int id=ranges[i].L+j;
if(j>m-clues[i]-1 && j<clues[i]) ans[id]='X';
else ans[id]='?';
}
}
for(int i=0;i<n;i++){
if(ans[i]=='.') ans[i]='_';
}
return ans;
}
# | 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... |