# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
102515 | ruhanhabib39 | Lamps (JOI19_lamps) | C++17 | 49 ms | 19988 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 INF = 1e9;
const int MAXN = 1e6;
int N;
char A[MAXN + 10], B[MAXN + 10];
int dp[MAXN + 10][2][2];
int main() {
scanf("%d%s%s", &N, A+1, B+1);
A[0] = B[0] = '0';
for(int i = 0; i <= N; i++) {
for(int a : {0, 1}) {
for(int t : {0, 1}) {
dp[i][a][t] = INF;
}
}
}
dp[0][0][0] = 0;
for(int i = 1; i <= N; i++) {
{
int& ref = dp[i][0][0];
if(A[i] == B[i]) {
ref = min({ref, dp[i-1][0][0], dp[i-1][0][1], dp[i-1][1][0], dp[i-1][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... |