結果
問題 | No.2209 Flip and Reverse |
ユーザー |
|
提出日時 | 2023-02-10 21:24:08 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 566 bytes |
コンパイル時間 | 1,750 ms |
コンパイル使用メモリ | 192,592 KB |
最終ジャッジ日時 | 2025-02-10 12:08:14 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h>using i64 = long long;int main() {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);int n;std::cin >> n;std::string s, t;std::cin >> s >> t;int ans = 1E9;for (int v = 0; v < 2; v++) {int dif = 0;for (int i = 0; i < n; i++) {dif += (s[i] != t[i]);}if (dif % 2 == v) {ans = std::min(ans, dif);}std::reverse(t.begin(), t.end());}std::cout << ans << "\n";return 0;}