이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <vector>
#include <utility>
#include "paint.h"
using namespace std;
bool Can[2][200005]={0};
int N,M;
bool have[200005][105][2]={0};
bool can[200005][105][2]={0};
int How[200005]={0};
int how[200005]={0};
int Big[200005];
string a;
vector < int > c;
bool F(int here,int what,int x)
{
int t;
if(have[here][what][x]) return can[here][what][x];
else if(here==N)
{
have[here][what][x]|=1;
can[here][what][x]|=(what==M);
return can[here][what][x];
}
else
{
have[here][what][x]|=1;
if(x==how[here]) return 0;
if(x==0)
{
t=here+c[what];
if(t>N) return 0;
if(what==M) return 0;
if(How[t-1]-How[here]) return 0;
if(F(t,what+1,1))
{
can[here][what][0]|=1;
Can[0][here]|=1;
Big[here]=max(Big[here],t-1);
}
}
else
{
can[here][what][1]|=F(here+1,what,0);
can[here][what][1]|=F(here+1,what,1);
Can[1][here]|=can[here][what][1];
}
}
return can[here][what][x];
}
string solve_puzzle(string s, vector < int > c)
{
int i,j,big=-1;
a=s;
::c=c;
N=s.length(),M=c.size();
for(i=0;i<N;i++)
{
if(i) How[i]=How[i-1];
How[i]+=(s[i]=='_');
Big[i]=-1;
if(s[i]=='_') how[i]=0;
else if(s[i]=='X') how[i]=1;
else how[i]=2;
}
F(0,0,0);
F(0,0,1);
for(i=0;i<N;i++)
{
for(j=max(big+1,i);j<=max(big,Big[i]);j++) Can[0][j]=1;
big=max(big,Big[i]);
}
for(i=0;i<N;i++)
{
if(Can[0][i]==0) s[i]='_';
else if(Can[1][i]==0) s[i]='X';
else s[i]='?';
}
return s;
}
| # | 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... |