結果
問題 | No.2209 Flip and Reverse |
ユーザー |
|
提出日時 | 2023-02-11 07:14:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 365 bytes |
コンパイル時間 | 1,721 ms |
コンパイル使用メモリ | 192,816 KB |
最終ジャッジ日時 | 2025-02-10 14:10:21 |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int N;cin>>N;string S,T;cin>>S>>T;int ans=N,cnt=0;for(int i=0;i<N;i++){if(S[i]!=T[i])++cnt;}if(cnt%2==0)ans=cnt;cnt=0;for(int i=0;i<N;i++){if(S[N-1-i]!=T[i])++cnt;}if(cnt%2)ans=min(ans,cnt);cout<<ans<<'\n';}