結果

問題 No.2209 Flip and Reverse
ユーザー irohasu19_irohasu19_
提出日時 2023-03-11 01:52:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 1,524 bytes
コンパイル時間 2,226 ms
コンパイル使用メモリ 205,644 KB
実行使用メモリ 7,216 KB
最終ジャッジ日時 2023-10-18 09:34:54
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 47 ms
7,216 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 1 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 56 ms
7,216 KB
testcase_15 AC 56 ms
7,216 KB
testcase_16 AC 56 ms
7,216 KB
testcase_17 AC 56 ms
7,216 KB
testcase_18 AC 55 ms
7,216 KB
testcase_19 AC 56 ms
7,216 KB
testcase_20 AC 57 ms
7,216 KB
testcase_21 AC 56 ms
7,216 KB
testcase_22 AC 56 ms
7,216 KB
testcase_23 AC 56 ms
7,216 KB
testcase_24 AC 53 ms
7,216 KB
testcase_25 AC 53 ms
7,216 KB
testcase_26 AC 53 ms
7,216 KB
testcase_27 AC 54 ms
7,216 KB
testcase_28 AC 47 ms
7,216 KB
testcase_29 AC 47 ms
7,216 KB
testcase_30 AC 47 ms
7,216 KB
testcase_31 AC 48 ms
7,216 KB
testcase_32 AC 46 ms
7,216 KB
testcase_33 AC 46 ms
7,216 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h> 
#define repr(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,n) for(int i=0;i<n;i++) 
#define reprrev(i,a,b) for(int i=b-1;i>=a;i--) // [a, b) 
#define reprev(i,n) reprrev(i,0,n) 
#define _GLIBCXX_DEBUG 
#define int long long         
using ll = long long; 
using ull = unsigned long long; 
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } 
const ll mod = 1e9+7; 
void chmod(ll &M){ 
  if(M >= mod) M %= mod; 
  else if(M < 0){ 
     M += (abs(M)/mod + 1)*mod; 
    M %= mod; 
} 
} 

int getl(int i, int N) { return i==0? N-1:i-1; }; 
int getr(int i, int N) { return i==N-1? 0:i+1; }; 
long long GCD(long long a, long long b) { 
  if (b == 0) return a; 
  else return GCD(b, a % b); 
} 
using namespace std; 
using Graph = vector<vector<int>>;
/* encode: ランレングス圧縮を行う
*/
vector<pair<char, int>> encode(const string& str) {
    int n = (int)str.size();
    vector<pair<char, int>> ret;
    for (int l = 0; l < n;) {
        int r = l + 1;
        for (; r < n && str[l] == str[r]; r++) {};
        ret.push_back({str[l], r - l});
        l = r;
    }
    return ret;
}
signed main() {
  int n; cin >> n;
  string S, T; cin >> S >> T;
  int diff = 0;
  rep(i, n) {
    if(S[i] != T[i]) diff++;
  }
  if(diff%2 != 0) reverse(S.begin(), S.end());
  int ans = 0;
  rep(i, n) {
    if(S[i] != T[i]) ans++;
  }
  cout << ans << endl;
  }
0