이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 | 
|---|
| 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... |