Submission #874070

#TimeUsernameProblemLanguageResultExecution timeMemory
874070vjudge1Lamps (JOI19_lamps)C++17
4 / 100
5 ms4524 KiB
#include<bits/stdc++.h>
     
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
 
#define pb              push_back
#define F               first
#define S               second
//#define mp              make_pair
#define all(x)          x.begin(),x.end()
#define file            freopen("txt.in", "r", stdin);freopen("txt.out", "w", stdout);
#define kill(x)         {cout << x << '\n'; return 0;}
//#define int				ll

#pragma GCC optimize("Ofast,unroll-loops")

const int N =  300 * 1000 + 10, LG = 24, MOD = 1e9+7, P = 701;
const ll inf = 1e12;

int n;
string s, t;

signed main(){
   //file;
    ios::sync_with_stdio(0);cin.tie(0);
    
    cin >> n >> s >> t;    
    
    int cnt0 = 0;
    for(int i = 0; i < n; ++i) {
        cnt0 += (s[i] == '0');
    }
    if(cnt0 == n) {
        t = t+'0';
        int ans = 0;
        for(int i = 1; i <= n; ++i) {
            if(t[i-1] == '1' && t[i] == '1') continue;
            if(t[i-1] == '1') ++ans;
        }
        cout << ans << '\n';
    }
    
}   

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...