Submission #569250


Source Code Expand

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	int n;
	cin >> n;

	string s;
	cin >> s;

	if(s.size() % 2 == 1) {
		cout << -1 << endl;
		return 0;
	}

	string a = s.substr(0, s.size()/2);
	string b = s.substr(s.size()/2);


	int ans = 0;
	rep(i, a.size()) {
		if(a[i] == b[i]) {
			continue;
		} else {
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}

Submission Info

Submission Time
Task B - ヘイホー君と置き換え
User Ry0u_
Language C++ (GCC 4.9.2)
Score 100
Code Size 727 Byte
Status AC
Exec Time 31 ms
Memory 928 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 4
AC × 88
Set Name Test Cases
Sample test_abacbabc.txt, test_abababab.txt, test_abcde.txt, test_26_codefestiv.txt
All test_100_bbaaababba.txt, test_100_bcbcbbccbc.txt, test_100_cccdcddccd.txt, test_100_dddccddccd.txt, test_100_kkkkjkkjkj.txt, test_100_lllklkkllk.txt, test_100_nooooonnnn.txt, test_100_prpttrstrs.txt, test_100_psupruuutq.txt, test_100_qpuutstspt.txt, test_100_qstsustsus.txt, test_100_qtrqqsqqup.txt, test_100_tpqqqrrrsp.txt, test_100_tsrrtqrqtt.txt, test_100_tussuutruq.txt, test_100_ussuttrtrs.txt, test_100_uuquqtspuu.txt, test_100_uuvvvuvvuv.txt, test_100_xxxyxxyyxx.txt, test_100_zzzyyyzyyz.txt, test_15_gunspifpdv.txt, test_17_hijkabcdab.txt, test_18_ahbicjdkea.txt, test_26_codefestiv.txt, test_33_vtootzhcdu.txt, test_72_nuauvasdgr.txt, test_73_ftnuvdtcny.txt, test_77_ksjradlaka.txt, test_77_txusqssdai.txt, test_83_amgctyikmg.txt, test_90_hseaevdcjj.txt, test_93_vpywbvvvne.txt, test_94_xliaqazebk.txt, test_98_bgefabfcgb.txt, test_98_cddabegacb.txt, test_98_cgbfcbgeed.txt, test_98_dagbdgcfbc.txt, test_98_dbcacbabad.txt, test_98_dffdbaabgf.txt, test_98_fdacgccfcd.txt, test_98_gagddgcegc.txt, test_98_gbfceggdea.txt, test_98_gddcfebeed.txt, test_a-b49.txt, test_a-b49a.txt, test_a-b50.txt, test_a-c32.txt, test_a-c32ab.txt, test_a-c33.txt, test_a-c33a.txt, test_a-pr-za-qs-z.txt, test_a-w3yyzzyyzza-w.txt, test_a-x2z46.txt, test_a-x2z47.txt, test_a-x2z52.txt, test_a-xz46a-z.txt, test_a-xz47a-z.txt, test_a-xz52a-z.txt, test_a-yy-aa-yy-a.txt, test_a-yy.txt, test_a-z.txt, test_a-z3a-u.txt, test_a-z3a-v.txt, test_a-za-z.txt, test_a-zb-za.txt, test_a-zz-a.txt, test_a3-z3.txt, test_a4-y4.txt, test_a99.txt, test_aa-y.txt, test_abababab.txt, test_abacbabc.txt, test_abcde.txt, test_az.txt, test_b100.txt, test_b4-y4dkqc.txt, test_b4-y4hhpp.txt, test_b4-z4.txt, test_byr.txt, test_kxwzajmx.txt, test_pp.txt, test_ssb4-y4ss.txt, test_x33y33z33.txt, test_x33y33z34.txt, test_x33y34z33.txt, test_x34y33z33.txt, test_z.txt, test_z98.txt
Case Name Status Exec Time Memory
test_100_bbaaababba.txt AC 26 ms 808 KB
test_100_bcbcbbccbc.txt AC 25 ms 924 KB
test_100_cccdcddccd.txt AC 26 ms 804 KB
test_100_dddccddccd.txt AC 26 ms 804 KB
test_100_kkkkjkkjkj.txt AC 28 ms 800 KB
test_100_lllklkkllk.txt AC 28 ms 796 KB
test_100_nooooonnnn.txt AC 27 ms 796 KB
test_100_prpttrstrs.txt AC 29 ms 800 KB
test_100_psupruuutq.txt AC 29 ms 804 KB
test_100_qpuutstspt.txt AC 27 ms 924 KB
test_100_qstsustsus.txt AC 29 ms 796 KB
test_100_qtrqqsqqup.txt AC 27 ms 916 KB
test_100_tpqqqrrrsp.txt AC 29 ms 708 KB
test_100_tsrrtqrqtt.txt AC 29 ms 804 KB
test_100_tussuutruq.txt AC 29 ms 800 KB
test_100_ussuttrtrs.txt AC 28 ms 792 KB
test_100_uuquqtspuu.txt AC 26 ms 808 KB
test_100_uuvvvuvvuv.txt AC 27 ms 928 KB
test_100_xxxyxxyyxx.txt AC 27 ms 780 KB
test_100_zzzyyyzyyz.txt AC 29 ms 752 KB
test_15_gunspifpdv.txt AC 27 ms 796 KB
test_17_hijkabcdab.txt AC 25 ms 920 KB
test_18_ahbicjdkea.txt AC 27 ms 920 KB
test_26_codefestiv.txt AC 27 ms 924 KB
test_33_vtootzhcdu.txt AC 27 ms 924 KB
test_72_nuauvasdgr.txt AC 27 ms 924 KB
test_73_ftnuvdtcny.txt AC 27 ms 924 KB
test_77_ksjradlaka.txt AC 27 ms 924 KB
test_77_txusqssdai.txt AC 26 ms 796 KB
test_83_amgctyikmg.txt AC 27 ms 796 KB
test_90_hseaevdcjj.txt AC 26 ms 808 KB
test_93_vpywbvvvne.txt AC 31 ms 732 KB
test_94_xliaqazebk.txt AC 27 ms 796 KB
test_98_bgefabfcgb.txt AC 27 ms 920 KB
test_98_cddabegacb.txt AC 26 ms 796 KB
test_98_cgbfcbgeed.txt AC 26 ms 748 KB
test_98_dagbdgcfbc.txt AC 27 ms 800 KB
test_98_dbcacbabad.txt AC 28 ms 916 KB
test_98_dffdbaabgf.txt AC 28 ms 916 KB
test_98_fdacgccfcd.txt AC 28 ms 796 KB
test_98_gagddgcegc.txt AC 28 ms 920 KB
test_98_gbfceggdea.txt AC 27 ms 792 KB
test_98_gddcfebeed.txt AC 28 ms 912 KB
test_a-b49.txt AC 29 ms 920 KB
test_a-b49a.txt AC 27 ms 796 KB
test_a-b50.txt AC 27 ms 796 KB
test_a-c32.txt AC 26 ms 796 KB
test_a-c32ab.txt AC 27 ms 792 KB
test_a-c33.txt AC 26 ms 792 KB
test_a-c33a.txt AC 27 ms 792 KB
test_a-pr-za-qs-z.txt AC 27 ms 800 KB
test_a-w3yyzzyyzza-w.txt AC 26 ms 920 KB
test_a-x2z46.txt AC 26 ms 796 KB
test_a-x2z47.txt AC 26 ms 804 KB
test_a-x2z52.txt AC 25 ms 920 KB
test_a-xz46a-z.txt AC 28 ms 920 KB
test_a-xz47a-z.txt AC 27 ms 804 KB
test_a-xz52a-z.txt AC 26 ms 916 KB
test_a-yy-aa-yy-a.txt AC 28 ms 796 KB
test_a-yy.txt AC 27 ms 796 KB
test_a-z.txt AC 26 ms 840 KB
test_a-z3a-u.txt AC 27 ms 800 KB
test_a-z3a-v.txt AC 27 ms 800 KB
test_a-za-z.txt AC 25 ms 920 KB
test_a-zb-za.txt AC 27 ms 924 KB
test_a-zz-a.txt AC 27 ms 796 KB
test_a3-z3.txt AC 27 ms 924 KB
test_a4-y4.txt AC 26 ms 800 KB
test_a99.txt AC 27 ms 800 KB
test_aa-y.txt AC 27 ms 928 KB
test_abababab.txt AC 27 ms 920 KB
test_abacbabc.txt AC 26 ms 800 KB
test_abcde.txt AC 26 ms 916 KB
test_az.txt AC 27 ms 920 KB
test_b100.txt AC 27 ms 920 KB
test_b4-y4dkqc.txt AC 27 ms 916 KB
test_b4-y4hhpp.txt AC 27 ms 928 KB
test_b4-z4.txt AC 25 ms 800 KB
test_byr.txt AC 27 ms 796 KB
test_kxwzajmx.txt AC 27 ms 920 KB
test_pp.txt AC 26 ms 928 KB
test_ssb4-y4ss.txt AC 27 ms 924 KB
test_x33y33z33.txt AC 24 ms 796 KB
test_x33y33z34.txt AC 27 ms 928 KB
test_x33y34z33.txt AC 26 ms 924 KB
test_x34y33z33.txt AC 26 ms 920 KB
test_z.txt AC 27 ms 924 KB
test_z98.txt AC 27 ms 792 KB