# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1223806 | vidux | Paint By Numbers (IOI16_paint) | C++17 | 0 ms | 328 KiB |
#include "paint.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define ALL(x) (x.begin()), (x.end())
#define DEBUG(x) cerr << #x << ": " << x << endl;
#define DEBUG_ARR(x) cerr << #x << ": "; for (auto &y : x) cout << y << " "; cout << endl;
#define SZ(x) ((int)x.size())
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
std::string solve_puzzle(std::string s, std::vector<int> c) {
int n = SZ(s);
int k = SZ(c);
vi w(n), b(n);
int pref = 0;
int extra = n-accumulate(ALL(c), 0)-k+1;
for (int i = 0; i < k; i++) {
for (int j = pref; j < c[i]+pref+extra; j++) {
b[j] = 1;
}
for (int j = 0; j < extra; j++) {
w[pref+j] = 1;
w[c[i]+pref+extra-1-j] = 1;
}
if (pref-1 >= 0) w[pref-1] = 1;
if (c[i]+pref+extra < n) w[c[i]+pref+extra] = 1;
pref += 1+c[i];
}
string ans(n, '?');
for (int i = 0; i < n; i++) {
if (w[i] && !b[i]) ans[i] = '_';
if (!w[i] && b[i]) ans[i] = 'X';
}
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... |