# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123192 | Hideo | Paint By Numbers (IOI16_paint) | C++14 | 2 ms | 504 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 <bits/stdc++.h>
#include "paint.h"
//#include "grader.cpp"
using namespace std;
const int N = 2e5 + 7;
int a[N], b[N], pr[N], sf[N];
int n;
std::string ans;
std::string solve_puzzle(std::string s, std::vector<int> c) {
n = c.size();
for (int i = 0; i < n; i++){
a[i + 1] = c[i];
pr[i + 1] = pr[i] + c[i] + 1;
}
if (pr[n] - 1 == s.size()){
int ct = 1;
for (int i = 1; i <= s.size(); i++){
if (i == pr[ct]){
ans += '_';
ct++;
}
else
ans += 'X';
}
return ans;
}
for (int i = n; i >= 1; i--)
sf[i] = sf[i + 1] + a[i] + 1;
for (int i = 1; i <= n; i++){
int r1, l2;
r1 = pr[i - 1] + a[i];
l2 = s.size() - sf[i] + 2;
for (int j = l2; j <= r1; j++){
b[j] = 1;
}
}
for (int i = 1; i <= s.size(); i++){
if (b[i] == 1)
ans += 'X';
else
ans += '?';
}
return ans;
}
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... |