結果
問題 | No.2209 Flip and Reverse |
ユーザー |
![]() |
提出日時 | 2023-02-10 21:23:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 42 ms / 2,000 ms |
コード長 | 335 bytes |
コンパイル時間 | 1,644 ms |
コンパイル使用メモリ | 192,096 KB |
最終ジャッジ日時 | 2025-02-10 12:07:03 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define int long longsigned main(){int N;cin>>N;string S,T;cin>>S>>T;int a = 0, b = 0;for(int i=0;i<N;i++){a += (S[i] != T[i]);b += (S[i] != T[N-i-1]);}int ans = 1e18;if(a%2 == 0) ans = min(ans,a);if(b%2) ans = min(ans,b);cout<<ans<<endl;}