結果
| 問題 |
No.2209 Flip and Reverse
|
| コンテスト | |
| ユーザー |
patricky_tau
|
| 提出日時 | 2023-02-15 03:46:56 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 48 ms / 2,000 ms |
| コード長 | 605 bytes |
| コンパイル時間 | 1,693 ms |
| コンパイル使用メモリ | 167,664 KB |
| 実行使用メモリ | 7,184 KB |
| 最終ジャッジ日時 | 2024-07-17 14:48:24 |
| 合計ジャッジ時間 | 5,202 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
int read() {
int x = 0, f = 1;
char c = getchar();
while (c < '0' || c > '9') { if (c == '-') f = -1; c = getchar(); }
while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
return x * f;
}
int main() {
read();
std::string s, t;
std::cin >> s >> t;
int ans = INT_MAX;
for (int m : { 0, 1 }) {
int cnt{};
for (int i = 0; i < s.size(); i++) cnt += s[i] != t[i];
if (cnt % 2== m) ans = std::min(ans, cnt);
std::reverse(s.begin(), s.end());
}
std::cout << ans << '\n';
return 0;
}
patricky_tau