# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1021852 | vjudge1 | Paint By Numbers (IOI16_paint) | C++17 | 8 ms | 6748 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>
#define ent '\n'
typedef long long ll;
using namespace std;
const int maxn = 5e5+12;
int suff[maxn][103];
int pref[maxn][103];
int can[maxn];
int prefw[maxn];
int prefb[maxn];
int c[maxn];
int n, k;
string solve_puzzle(string s, vector<int> C){
n = s.size(), k = C.size();
for(int i=0;i<n;i++){
prefw[i+1] = prefw[i] + (s[i] == '_');
prefb[i+1] = prefb[i] + (s[i] == 'X');
c[i+1] = C[i];
}
string ans = "";
pref[0][0] = 1;
for(int i=1;i<=n;i++){
for(int j=0;j<=k;j++){
if(s[i-1] != 'X') pref[i][j] = pref[i-1][j];
if(j > 1 && i > c[j] && pref[i-c[j]-1][j-1] && prefw[i] == prefw[i-c[j]] && s[i - c[j] - 1] != 'X') {
pref[i][j] = 1;
}
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... |