結果
| 問題 |
No.2209 Flip and Reverse
|
| コンテスト | |
| ユーザー |
sorag
|
| 提出日時 | 2023-02-10 23:45:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 695 bytes |
| コンパイル時間 | 3,316 ms |
| コンパイル使用メモリ | 229,208 KB |
| 実行使用メモリ | 7,184 KB |
| 最終ジャッジ日時 | 2024-07-07 17:35:40 |
| 合計ジャッジ時間 | 5,681 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include<bits/stdc++.h>
#include<atcoder/all>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<math.h>
#include<set>
#include<regex>
#include<deque>
#include<queue>
#define all(x) x.begin(),x.end()
#define gall(x) x.begin(),x.end(),greater<>()
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define pb push_back
#define ll long long
#define P pair<int,int>
#define LP pair<ll,ll>
using namespace std;
using namespace atcoder;
int main(){
int n; cin>>n;
string s,t; cin>>s>>t;
int cnt1=0,cnt2=0,ans=0;
rep(i,n){
if(s[i]=='1') cnt1++;
if(t[i]=='1') cnt2++;
}
if(cnt1%2!=cnt2%2) reverse(all(t));
rep(i,n){
if(s[i]!=t[i])ans++;
}
cout<<ans<<endl;
return 0;
}
sorag