# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
381006 | Karliver | Paint By Numbers (IOI16_paint) | C++14 | 1 ms | 364 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 <cstdlib>
#include <bits/stdc++.h>
#include <fstream>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(20) << (x)
#define all(v) (v).begin(), (v).end()
using namespace std;
#define forn(i,n) for (int i = 0; i < (n); ++i)
using ll = long long;
int mod = (ll)1e9 + 7;
#define PI acos(-1)
typedef pair<int, int> pairs;
typedef complex<ll> G;
const int INF = 1e9 + 1;
const int N = 1e6;
const double eps = 1e-3;
std::string solve_puzzle(std::string s, std::vector<int> c) {
int k = c.size();
int n = s.size();
int f = 0;
bool bad = 0;
for(int i = 0;i < n;) {
int cnt = 0;
int j = i;
char pr = s[i];
if(s[i] == 'X' || s[i] == '.') {
while(j < n && (s[j] == '.' || s[j] == 'X'))++j;
while(f < k && j - i >= c[f]) {
while(c[f]) {
--c[f];
assert(i < n);
s[i] = 'X';
++i;
}
++i;
++f;
}
i = j;
}
else {
while(i < n && s[i] == '_')++i;
}
}
forn(i, n)if(s[i] == '.')s[i] = '_';
return s;
}
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... |