제출 #1067159

#제출 시각아이디문제언어결과실행 시간메모리
1067159Braabebo10Lamps (JOI19_lamps)C++17
0 / 100
0 ms348 KiB
#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; cout<<i<<nl; for(ll j=i;j<n;j++){ if(b[j]=='0')op1=false; if(b[j]=='1')op2=false; if(a[j]==b[j])op3=false; else op4=false; if(op1||op2||op3)dp[i]=min(dp[i],dp[j+1]+1); if(op4)dp[i]=min(dp[i],dp[j+1]); } // cout<<dp[i]<<nl; } cout<<dp[0]; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...