結果
| 問題 |
No.2209 Flip and Reverse
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-02-10 22:35:17 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| コード長 | 490 bytes |
| コンパイル時間 | 1,543 ms |
| コンパイル使用メモリ | 167,532 KB |
| 実行使用メモリ | 7,184 KB |
| 最終ジャッジ日時 | 2024-07-07 16:41:04 |
| 合計ジャッジ時間 | 3,341 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
int N;
cin >> N;
string s, t;
cin >> s >> t;
int ans1 = 0;
for (int i = 0; i < N; i ++) {
ans1 += s[i] != t[i];
}
int ans = 1e9 +7;
if (ans1 % 2 == 0) {
ans = ans1;
}
int ans2 = 0;
for (int i = 0; i < N; i ++) {
ans2 += s[N - i - 1] != t[i];
}
if (ans2 % 2 == 1) {
ans = min(ans, ans2);
}
cout << ans << endl;
}