# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131911 | Masterdan | Paint By Numbers (IOI16_paint) | C++14 | 2 ms | 424 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 <bits/stdc++.h>
#define MIN -1
#define MAX 1000000000
#define all(a) a.begin (), a.end ()
#define pb push_back
#define mp make-pair
using namespace std;
typedef vector <int> vi;
typedef long long int ll;
typedef pair <int, int> ii;
string solve_puzzle(string s, vector<int> c) {
string res;
int n=s.size ();
int k=c.size ();
vector <int> v1;
for(int i=0;i<k;i++){
//if(c1==k)break;
int t=i;
for(int j=0;j<c[i];j++){
res+='X';
}
v1.pb(res.size ());
if(res.size()==n)break;
res+='_';
}
int s1=1;
//cout<<res<<endl;
if(res[res.size ()-1]!='_'){
return res;
}else{
for(int i=res.size ();i<n;i++){res+='_';s1++;}
}
int aux[n+1];
//cout<<res<<endl;
int j=0;
string gg;
gg.resize(res.size ());
/*for(int i=0;i<v1.size ();i++)cout<<v1[i]<<" ";
cout<<endl;*/
for(int i=0;i<res.size();i++){
if(res[i]=='X'){
if(v1[j]-1>=i+s1){
if(res[i+s1]=='X'){
gg[i+s1]='X';
}
}
if(i==v1[j]-1){
j++;
}
}
//cout<<res<<endl;
}
/*for(int i=0;i<n;i++)cout<<aux[i]<<" ";
cout<<endl;*/
for(int i=0;i<gg.size ();i++){
if(gg[i]!='X')gg[i]='?';
if(s[i]=='_')gg[i]='_';
}
return gg;
}
/*
const int S_MAX_LEN = 200 * 1000;
char buf[S_MAX_LEN + 1];
int main() {
assert(1 == scanf("%s", buf));
std::string s = buf;
int c_len;
assert(1 == scanf("%d", &c_len));
std::vector<int> c(c_len);
for (int i = 0; i < c_len; i++) {
assert(1 == scanf("%d", &c[i]));
}
std::string ans = solve_puzzle(s, c);
printf("%s\n", ans.data());
return 0;
}
*/
Compilation message (stderr)
# | 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... |