# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1065703 | sunboi | Paint By Numbers (IOI16_paint) | C++17 | 1 ms | 444 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"
using namespace std;
string solve_puzzle(string s, vector<int> c){
int n = s.size();
int k = c.size();
int suf = -(c[0] + 1);
int pref = 0;
set<pair<int, int>> black;
for (int x : c){
suf += x + 1;
}
for (int i = 0; i < k; i++){
//cout << "intervalo::::" << pref << ' ' << suf << endl;
int r = min(pref + c[i] - 1, n - suf - 1);
int l = max(pref, n - suf - c[i]);
//cout << l << ' ' << r << endl;
if (r >= l) black.insert({l, r});
pref += c[i] + 1;
if (i < k - 1) suf -= c[i + 1] + 1;
}
for (pair<int, int> x : black){
//cout << x.first << ' ' << x.second << endl;
for (int i = x.first; i <= x.second; i++) s[i] = 'X';
# | 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... |