# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
934705 | Macker | Paint By Numbers (IOI16_paint) | C++14 | 2064 ms | 1080 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>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define FOR(i, n) for (int i = 0; i < n; i++)
bool can(string s, vector<int> c){
int n = s.size();
int k = c.size();
vector<vector<int>> dp(n + 1, vector<int>(k + 1));
dp[0][0] = 1;
FOR(i, n + 1) FOR(j, k + 1){
if(!dp[i][j]) continue;
if(i != n && s[i] != 'X') dp[i + 1][j] = 1;
if(dp[i][j] != 2 && j != k && i + c[j] <= n ){
bool f = 0;
FOR(l, c[j]){
f = max(f, s[l + i] == '_');
}
if(!f) dp[i + c[j]][j + 1] = 2;
}
}
return dp[n][k] != 0;
}
std::string solve_puzzle(std::string s, std::vector<int> c) {
FOR(i, s.size()){
if(s[i] != '.') continue;
s[i] = 'X';
if(!can(s, c)) {
s[i] = '_';
continue;
}
s[i] = '_';
if(!can(s, c)){
s[i] = 'X';
continue;
}
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... |