結果
問題 |
No.2209 Flip and Reverse
|
ユーザー |
|
提出日時 | 2024-03-15 05:28:29 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 579 bytes |
コンパイル時間 | 1,364 ms |
コンパイル使用メモリ | 167,072 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-09-29 23:58:08 |
合計ジャッジ時間 | 2,750 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl '\n' void solve(){ int n; cin>>n; string s,t; cin>>s>>t; int cnt1 = 0; int cnt2 = 0; for(int i=0;i<n;i++){ cnt1 += s[i] != t[i]; cnt2 += s[n-i-1] != t[i]; } int ans = 1e9; if(cnt1 % 2 == 0) ans = min(ans , cnt1); if(cnt2 & 1) ans = min(ans , cnt2); cout<<ans<<endl; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t=1; //cin>>t; while(t--){ solve(); } return 0; }