結果
| 問題 |
No.1183 コイン遊び
|
| コンテスト | |
| ユーザー |
beet
|
| 提出日時 | 2020-11-15 15:34:23 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 177 ms / 2,000 ms |
| コード長 | 1,124 bytes |
| コンパイル時間 | 2,185 ms |
| コンパイル使用メモリ | 197,704 KB |
| 最終ジャッジ日時 | 2025-01-16 00:57:30 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
// verification-helper: PROBLEM https://yukicoder.me/problems/4872
#include<bits/stdc++.h>
using namespace std;
#define call_from_test
#ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T=int>
vector<T> read(size_t n){
vector<T> ts(n);
for(size_t i=0;i<n;i++) cin>>ts[i];
return ts;
}
//END CUT HERE
#ifndef call_from_test
signed main(){
return 0;
}
#endif
#ifndef call_from_test
#include <bits/stdc++.h>
using namespace std;
#endif
//BEGIN CUT HERE
template<typename T>
decltype(auto) runlength(vector<T> vs){
vector<pair<T, int>> es;
for(auto v:vs){
if(es.empty() or es.back().first!=v)
es.emplace_back(v,0);
es.back().second++;
}
return es;
}
//END CUT HERE
#ifndef call_from_test
//INSERT ABOVE HERE
signed main(){
return 0;
}
#endif
#undef call_from_test
signed main(){
cin.tie(0);
ios::sync_with_stdio(0);
int n;
cin>>n;
auto as=read(n);
auto bs=read(n);
vector<int> cs(n);
for(int i=0;i<n;i++) cs[i]=as[i]^bs[i];
int ans=0;
for(auto[v,_]:runlength(cs)) ans+=v;
cout<<ans<<endl;
return 0;
}
beet