結果
| 問題 |
No.2209 Flip and Reverse
|
| ユーザー |
shirokami
|
| 提出日時 | 2023-02-10 21:41:48 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 1,777 bytes |
| コンパイル時間 | 3,018 ms |
| コンパイル使用メモリ | 251,148 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-07 15:53:56 |
| 合計ジャッジ時間 | 4,455 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
// #include <boost/math/tools/minima.hpp>
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision;
// #include <atcoder/all>
// using namespace atcoder;
// https://atcoder.github.io/ac-library/production/document_ja/
typedef long long int ll;
typedef long double ld;
const ll mod = 1e9+7;
const ll INF = 922337203685477580;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define Rep(i,a,n) for (ll i = (a); i < (n); ++i)
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)
using V = vector<ll>;
using P = pair<ll,ll>;
vector<ll> dx = {1, 0, -1, 0, 1, 1, -1, -1};
vector<ll> dy = {0, 1, 0, -1, 1, -1, 1, -1};
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
struct edge{ll to, cost;};
using graph = vector<vector<edge> >;
struct IoSetup {
IoSetup() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
cout << setprecision(15) << fixed;
}
} iosetup;
void printvec(vector<ll> a) {
for(ll i = 0; i < a.size(); i++) {
cout << a[i] << ' ';
}
cout << '\n';
}
void printgrid(vector<vector<ll>> g) {
for (ll i = 0; i < g.size(); i++) {
printvec(g[i]);
}
}
int main() {
ll n;
cin >> n;
string s, t;
cin >> s >> t;
ll ans = INF;
ll tmp = 0;
rep(i,n) {
if (s[i] != t[i]) tmp++;
}
if (tmp%2 == 0) {
chmin(ans, tmp);
}
reverse(All(s));
tmp = 0;
rep(i,n) {
if (s[i] != t[i]) tmp++;
}
if (tmp%2 == 1) {
chmin(ans, tmp);
}
cout << ans << '\n';
}
shirokami