結果

問題 No.2209 Flip and Reverse
ユーザー AhmadovAhmadov
提出日時 2023-03-13 16:07:32
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 1,103 bytes
コンパイル時間 5,395 ms
コンパイル使用メモリ 245,592 KB
実行使用メモリ 5,568 KB
最終ジャッジ日時 2023-10-18 11:09:15
合計ジャッジ時間 7,486 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 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 8 ms
5,568 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 2 ms
4,348 KB
testcase_14 AC 9 ms
5,568 KB
testcase_15 AC 9 ms
5,568 KB
testcase_16 AC 9 ms
5,568 KB
testcase_17 AC 9 ms
5,568 KB
testcase_18 AC 9 ms
5,568 KB
testcase_19 AC 9 ms
5,568 KB
testcase_20 AC 9 ms
5,568 KB
testcase_21 AC 9 ms
5,568 KB
testcase_22 AC 9 ms
5,568 KB
testcase_23 AC 8 ms
5,568 KB
testcase_24 AC 8 ms
5,568 KB
testcase_25 AC 9 ms
5,568 KB
testcase_26 AC 8 ms
5,568 KB
testcase_27 AC 8 ms
5,568 KB
testcase_28 AC 9 ms
5,568 KB
testcase_29 AC 9 ms
5,568 KB
testcase_30 AC 8 ms
5,568 KB
testcase_31 AC 9 ms
5,568 KB
testcase_32 AC 8 ms
5,568 KB
testcase_33 AC 8 ms
5,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define boost   ios::sync_with_stdio(0);cin.tie(0);
#define file    freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);

#define pb  push_back
#define mp  make_pair
#define ins insert
#define int long long
#define uint unsigned long long

#define pii pair<int,int>
#define st  set<int>

#define get(arr)  for(auto& v:arr){cin>>v;}
#define all(x)   (x).begin(),(x).end()
#define sz(x)    (x).size()
#define fix(a,b) setprecision(a)<<fixed<<(b)
#define drop(x)  cout<<(x)<<endl;return;
#define print(x,a,b) for(auto v:(x)){cout<<(v)<<(a);}cout<<(b)
#define INF 1e9
string alpha="abcdefghijklmnopqrstuvwxyz";
const long long mod=12345;
int _case=1;
void _(){
    int n;cin>>n;
    string s,t;
    cin>>s>>t;
    int diff=0;
    for(int i=0;i<n;i++){
        diff+=(s[i]!=t[i]);
    }
    if(diff&1){
        reverse(all(s));

    }
    int cnt=0;
    for(int i=0;i<n;i++){
        cnt+=s[i]!=t[i];
    }
    cout<<cnt<<endl;
}

signed main(){
    boost;
    // file;
    int T=1;
    // cin>>T;
    while(T--){
        _();
        // _case++;
    }
}
0