結果

問題 No.2209 Flip and Reverse
ユーザー no wayno way
提出日時 2023-02-10 22:01:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 24 ms / 2,000 ms
コード長 334 bytes
コンパイル時間 1,680 ms
コンパイル使用メモリ 164,348 KB
実行使用メモリ 5,592 KB
最終ジャッジ日時 2023-09-21 23:16:38
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 13 ms
5,412 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 23 ms
5,468 KB
testcase_15 AC 24 ms
5,500 KB
testcase_16 AC 24 ms
5,324 KB
testcase_17 AC 23 ms
5,420 KB
testcase_18 AC 24 ms
5,592 KB
testcase_19 AC 23 ms
5,472 KB
testcase_20 AC 23 ms
5,320 KB
testcase_21 AC 24 ms
5,416 KB
testcase_22 AC 23 ms
5,412 KB
testcase_23 AC 24 ms
5,320 KB
testcase_24 AC 20 ms
5,392 KB
testcase_25 AC 20 ms
5,456 KB
testcase_26 AC 20 ms
5,468 KB
testcase_27 AC 21 ms
5,376 KB
testcase_28 AC 14 ms
5,388 KB
testcase_29 AC 13 ms
5,384 KB
testcase_30 AC 13 ms
5,380 KB
testcase_31 AC 13 ms
5,376 KB
testcase_32 AC 13 ms
5,384 KB
testcase_33 AC 13 ms
5,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+10;
char s[N],t[N];
int n,ans;
int main(){
	scanf("%d",&n);
	scanf("%s",s);
	scanf("%s",t);
	int w=0,q=n+1;
	for (int i=0;i<n;i++) if (s[n-1-i]!=t[i]) ans++;
	for (int i=0;i<n;i++) if (s[i]!=t[i]) w++;
	if (w%2==0) q=min(q,w);
	if (ans&1) q=min(q,ans);
	printf("%d\n",q);
}
0