# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
126425 | TadijaSebez | Lamps (JOI19_lamps) | C++11 | 452 ms | 43644 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;
const int N=1000050;
const int inf=1e9+7;
int dp[N][2][5];
char a[N],b[N];
int main()
{
int n;
scanf("%i %s %s",&n,a+1,b+1);
for(int i=0;i<2;i++) for(int j=0;j<5;j++) dp[0][i][j]=inf;
dp[0][0][0]=0;
for(int i=1;i<=n;i++)
{
for(int j=0;j<2;j++)
{
for(int k=0;k<5;k++)
{
int mask=min(k,3)+j*4;
int now=a[i]-'0';
if(k>0 && (k&1)) now=0;
else if(k>0) now=1;
if(j) now^=1;
dp[i][j][k]=inf;
if(now==b[i]-'0')
{
for(int j2=0;j2<2;j2++)
{
for(int k2=0;k2<5;k2++)
{
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... |