# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
986331 | VMaksimoski008 | Paint By Numbers (IOI16_paint) | C++17 | 152 ms | 600 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>
using namespace std;
using ll = long long;
string solve_puzzle(std::string s, std::vector<int> c) {
int n = s.size();
int m = c.size();
if(n - 1 <= 20) {
vector<int> mp(n);
int cnt = 0;
for(int mask=0; mask<(1<<n); mask++) {
vector<int> v;
if(mask & 1) v.push_back(1);
for(int i=1; i<n; i++) {
if(mask & (1 << i)) {
if(mask & (1 << (i-1))) v.back()++;
else v.push_back(1);
}
}
if(v == c) {
cnt++;
for(int i=0; i<n; i++)
if(mask & (1 << i)) mp[i]++;
}
}
string str = "";
for(int i=0; i<n; i++) {
if(mp[i] == cnt) str += 'X';
else if(mp[i] > 0) str += '?';
else str += '_';
}
return str;
}
s = "." + s;
return "";
}
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... |