# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1026778 | boyliguanhan | Paint By Numbers (IOI16_paint) | C++17 | 242 ms | 11468 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;
bitset<200100> tran1[101],tran2,ok[101],ok2[101],wht,blk;
int sumblk[200100],prfblk[200100],prfwht[200100],n_;
inline int nowht(int l,int r){
return r<=n_&&prfwht[r]==prfwht[l-1];
}
inline int noblk(int l){
return !blk[l];
}
string solve_puzzle(string s, vector<int> c) {
int n=s.size(),k=c.size();
n_=n;
s=" "+s;
for(int i=1;i<=n;i++)
blk[i]=s[i]=='X',prfwht[i]=s[i]=='_';
for(int i=1;i<=n;i++)
prfblk[i]+=prfblk[i-01],prfwht[i]+=prfwht[i-1];
for(int i=1;i<=n;i++){
for(int j=0;j<k;j++)
tran1[j][i]=nowht(i,i+c[j]-1)&&noblk(i+c[j]);
tran2[i]=noblk(i);
}
ok[0][1]=1;
for(int i=1;i<=n;i++) {
if(tran2[i])for(int j=0;j<=k;j++)
ok[j][i+1]=ok[j][i+1]|ok[j][i];
for(int j=0;j<k;j++)if(tran1[j][i]&&ok[j][i])
ok[j+1][i+c[j]+1]=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... |