# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
545094 | chonka | Lamps (JOI19_lamps) | C++98 | 14 ms | 8416 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 MAXN 1000007
int n ;
string a , b ;
int dp[ MAXN ] ;
void input ( ) {
cin >> n >> a >> b ;
}
void solve ( ) {
int diff = 0 ;
int mn_0 , mn_1 ;
mn_0 = mn_1 = 3 * MAXN ;
for ( int i = 1 ; i <= n ; ++ i ) {
dp[ i ] = MAXN ;
if ( a[ i - 1 ] == b[ i - 1 ] ) {
dp[ i ] = min ( dp[ i ] , dp[ i - 1 ] ) ;
}
if ( i > 1 && b[ i - 1 ] != b[ i - 2 ] ) {
++ mn_0 , ++ mn_1 ;
}
if ( b[ i - 1 ] == '0' ) {
dp[ i ] = min ( dp[ i ] , ( mn_0 + 1 ) / 2 ) ;
}
# | 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... |