結果
| 問題 | No.1183 コイン遊び |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-08-22 13:15:14 |
| 言語 | C++17(clang) (17.0.6 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 140 ms / 2,000 ms |
| コード長 | 1,175 bytes |
| 記録 | |
| コンパイル時間 | 3,553 ms |
| コンパイル使用メモリ | 141,980 KB |
| 実行使用メモリ | 19,308 KB |
| 最終ジャッジ日時 | 2024-10-15 07:26:48 |
| 合計ジャッジ時間 | 8,117 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <numeric>
#include <set>
using namespace std;
struct aaa{aaa(){cin.tie(nullptr); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20);};}aaa;\
template <class T1, class T2>ostream &operator<<(ostream &o,const pair<T1,T2>&p){o<<"("<<p.first<<","<<p.second<<")";return o;}
template <class T>ostream &operator<<(ostream &o,const vector<T>&v){o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
#define debug(v) {cerr<<"\033[1;36m[debug]\033[m "<<#v<<" : "<<v<<endl;}
using int64 = long long;
using P = pair<int,int>;
int main() {
int n;
cin >> n;
vector a(n,0);
for (int i=0; i<n; i++) cin >> a[i];
vector b(n,0);
for (int i=0; i<n; i++) cin >> b[i];
vector<P> len;
len.emplace_back(a[0]==b[0], 0);
for (int i=0; i<n; i++) {
if ((a[i] == b[i]) == len.back().first) len.back().second++;
else len.emplace_back(a[i]==b[i],1);
}
int ans = 0;
for (auto [a,b] : len) {
if (!a) ans++;
}
cout << ans << endl;
}