Submission #869603

# Submission time Handle Problem Language Result Execution time Memory
869603 2023-11-05T02:46:00 Z 12345678 Lamps (JOI19_lamps) C++17
4 / 100
14 ms 19600 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=1e6+5;
int dp[nx][4], n;
string a, b;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>a>>b;
    dp[0][1]=dp[0][2]=dp[0][3]=INT_MAX;
    for (int i=1; i<=n; i++)
    {
        dp[i][0]=dp[i][1]=dp[i][2]=dp[i][3]=INT_MAX;
        int mn=min({dp[i-1][0], dp[i-1][1], dp[i-1][2], dp[i-1][3]});
        if (a[i-1]==b[i-1]) dp[i][0]=mn;
        if (b[i-1]=='1') dp[i][1]=min(dp[i-1][1], mn+1);
        if (b[i-1]=='0') dp[i][2]=min(dp[i-1][2], mn+1);
        if (a[i-1]!=b[i-1]) dp[i][3]=min(dp[i-1][3], mn+1);
    }
    cout<<min({dp[n][0], dp[n][1], dp[n][2], dp[n][3]});
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 460 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Incorrect 0 ms 460 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 460 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Incorrect 0 ms 460 KB Output isn't correct
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 11 ms 19436 KB Output is correct
8 Correct 13 ms 19484 KB Output is correct
9 Correct 12 ms 19376 KB Output is correct
10 Correct 12 ms 19384 KB Output is correct
11 Correct 12 ms 19316 KB Output is correct
12 Correct 12 ms 19376 KB Output is correct
13 Correct 12 ms 19304 KB Output is correct
14 Correct 14 ms 19600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 460 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Incorrect 0 ms 460 KB Output isn't correct
14 Halted 0 ms 0 KB -