Submission #1067110

# Submission time Handle Problem Language Result Execution time Memory
1067110 2024-08-20T11:31:44 Z Braabebo10 Lamps (JOI19_lamps) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#define ll long long
#define nl "\n"
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int main() {
    fast
    ll n;
    string a,b;
    cin>>n>>a>>b;
    ll dp[n+1]={};
    memset(dp,0x3f, sizeof(dp));
    dp[n]=0;
    for(ll i=n-1;i>=0;i--){
        bool op1=true,op2=true,op3=true,op4=true;
        for(ll j=i;j<n;j++){
            if(a[j]=='1'&&b[j]=='0')op1=false;
            if(a[j]=='0'&&b[j]=='1')op2=false;
            if(a[j]==b[j])op3=false;
            else op4=false;
            if(op1||op2||op3||op4)dp[i]=min(dp[i],dp[j+1]+1);
        }
    }
    cout<<dp[0];
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -