結果
| 問題 | 
                            No.1183 コイン遊び
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tor1atama1
                         | 
                    
| 提出日時 | 2021-08-22 19:40:36 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 319 ms / 2,000 ms | 
| コード長 | 1,119 bytes | 
| コンパイル時間 | 1,801 ms | 
| コンパイル使用メモリ | 169,636 KB | 
| 実行使用メモリ | 11,136 KB | 
| 最終ジャッジ日時 | 2024-11-06 18:34:40 | 
| 合計ジャッジ時間 | 12,053 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 32 | 
ソースコード
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vll=vector<ll>;
using vvll=vector<vll>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define ALL(v) v.begin(),v.end()
#define pb push_back
template<class T>bool chmax(T &a, const T &b) {if (a<b) {a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if (b<a) {a=b; return 1;} return 0;}
template<class T>void printv(vector<T> v){ll n=v.size(); rep(i,n){cout<<v[i]; if(i==n-1)cout<<endl; else cout<<' ';}}
template<class T>void printvv(vector<vector<T>> v){for(auto V:v) printv(V);}
//constexpr int INF=1001001001;
//constexpr int mod=1e9+7;
//constexpr int mod=998244353;
int main(){
    int n; cin>>n;
    vi a(n),b(n);
    rep(i,n) cin>>a[i];
    rep(i,n) cin>>b[i];
    int ans=1;
    int pre=a[0]^b[0];
    rep(i,n) {
        if((a[i]^b[i])!=pre) ans++;
        pre=a[i]^b[i];
    }
    if(ans&1&&(a[0]^b[0])==1) ++ans;
    ans/=2;
    cout<<ans<<endl;
}
            
            
            
        
            
tor1atama1