QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#197713 | #3513. Assessing Genomes | MahmoudAtia# | AC ✓ | 1ms | 3896kb | C++14 | 1.5kb | 2023-10-02 18:55:36 | 2023-10-02 18:55:37 |
Judging History
answer
#include <bits/stdc++.h>
typedef long double ld;
typedef long long ll;
using namespace std;
int di[] = {1, 0, -1, 0, 0, 1, -1, 1};
int dj[] = {0, 1, 0, -1, -1, 0, 1, -1};
const ll oo = 1e18;
const int N = 55, M = 1e5 + 5, MOD = 998244353;
#define EPS 1e-9
int n, m, k, d;
string s1[N], s2[N];
int main() {
// ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) cin >> s1[i];
for (int i = 1; i <= n; i++) cin >> s2[i];
vector<int> v1, v2;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= s1[i].length(); j++) {
if (s1[i].length() % j) continue;
bool no = 0;
for (int k = 0; k < s1[i].length(); k++) {
if (s1[i][k] != s1[i][k % j]) no = 1;
}
if (!no) {
v1.push_back(j);
break;
}
}
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= s2[i].length(); j++) {
if (s2[i].length() % j) continue;
bool no = 0;
for (int k = 0; k < s2[i].length(); k++) {
if (s2[i][k] != s2[i][k % j]) no = 1;
}
if (!no) {
v2.push_back(j);
break;
}
}
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
ll ans = 0;
for (int i = 0; i < n; i++) ans += (v1[i] - v2[i]) * (v1[i] - v2[i]);
cout << ans;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3644kb
input:
2 TTTTTT TATG TATATA AAAGAAAG
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
3 abcdef aaa bab AbAb xyzxyz X
output:
10
result:
ok single line: '10'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
50 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
0
result:
ok single line: '0'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3852kb
input:
50 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...
output:
0
result:
ok single line: '0'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3572kb
input:
50 abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc...
output:
0
result:
ok single line: '0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
1 aba x
output:
4
result:
ok single line: '4'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
50 hbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcak xkhktuzqejivxjyqdgxwgxfptugwdjsxmsfecelafxgtrv...
output:
17425
result:
ok single line: '17425'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3540kb
input:
50 jyownbbxucekrpmqvygmvnhvcboaysqqqygfblgorlngnoxidywmvmzdlyekraxsoaupzzhnroadarirkjlkleahfbvdzyerfahcwwxyuudvprecjrtqpkpouvbimtydmkwkgoesntizfaqxunkrrkpopbvhbzrlkpqafgdqiprvtjwwcjgbcjesvauiphdpxezwofmuuctlqknbnwbggawjnroesrqnjxrfdckrbhxgwtcjvkdxcedaai kdutukdutukdutukdutukdutukdutukdutukdutukdutuk...
output:
72150
result:
ok single line: '72150'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
50 wajcsgssmwpbzljnvqjnbpuzfkqiviftgmsnnyaodckukayihynxsshefxtchgjwsmhjfuqsqpjcaacfphfxnjhlnmywtbuadvynxnqiaxyxxodgqjigepqxhzqhvvshyoozvvxipftmcufbzqqeyjbgpqncqfefsrqdclpypbkqnnqungmdmhxsgxdeqdcxorvmtypsljamiposypjfkbdnypnjsaazcmpttudyojekendpxqnwnhnkto aQzTNvYddoPOBqxGlWWAxmovmaQzTNvYddoPOBqxGlWWAx...
output:
50025
result:
ok single line: '50025'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
50 ZNVWEBXZTBFFCUMYVLAEVAHCOLSVERPRHDQLECQLIXKTDHNJNCNUBMAXVXFAELLXOXICMCGZESVBVZHFVIPKGGGXHAOJTDXTCPYZKSDWBASFQFMMMXTVNHSRKTHLRDVCUSSTPQRHRTAVRBIPHGWKDJWSKAEEGHWFTPDHTATFLXSAXDTDCCWSYSTQHIBWNQRPZWUMGXCEVHYSQKKPFSQLBAZUZFOQFYEDHSZDXJKOPSAONWOKHLDHTDOGGX ornijzqqwdkqwnpokecffotwwilggslmxfhfjtgnwblimm...
output:
175875
result:
ok single line: '175875'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
50 egftescorktaaqihwjavbrwguynrluxfhsuiabezawrfsmammhapeebzvvmooxusvkzrqfmvstrgkuojxjiszlahgkakjyreaymhhmtakwengrqhekvfczfyvwmrulmkwkzfmtewjrvuwjjtmjsutgyofrtkgwyvjbnrcuxozhfgddgyozsafswmlihhsjmfxvyjwbfjmjrevjpjrqekysrdffryqdwxljjtivgymroobmqwujhbxwoasc pufvwgqtizcvpzcagbvhhvkcezrhgxoknpolhghmkoimmm...
output:
76075
result:
ok single line: '76075'
Test #12:
score: 0
Accepted
time: 1ms
memory: 3592kb
input:
50 DIWYKNELNHZDZMXMSNXGUROBAPAKEPWBKACAYXGBTVQJSZYBHBMXLIZLSDHSZBAYXXNDUYQOGKZWOWLVENJXYNIHKQWFKZIHWLVWMADESAIHXLHKIJFKOFVBQXWCYQIYSBGKCVOJWVIMXAHFEHEEETIQDVRSKMQJIWKXJTNDPRGPOSYPLOTFIKRNWCJPNEREGMQWJCLPJPYAEUCPXESALXMWBYCPLNPHCCPIDPGWSZOMFGTYRJOYPBDCXG NQTLOQRJZGSEBFKQROFDZDKVQNQTLOQRJZGSEBFKQROFDZ...
output:
142700
result:
ok single line: '142700'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3656kb
input:
50 AIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNT rfzpprfzpprfzpprfzpprfzpprfzpprfzpprfzpprfzppr...
output:
171100
result:
ok single line: '171100'
Test #14:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
50 MAUDPQDGLAPKTHPTXLMKTCQRJXFANZLYSYCPWVHEFORTNEWFSTVJDAPDIEOCUFCDLIJZHYPAPGFUJAGDECXBJNWCDPLAXLEHEXNHHSISXLXHWUMLFETSTLRSUNCCNWLAOTDKBITFMUMKMDRJAJJRDSFTNJKIBNRYYWEEMZELJRACBRYPKDFKQAXLBZCXSDWYISZIYBPYJTEAFGVJZYEGKPDWZOGSIXJHIHWITOQMFYJGGDQZRXSPRXQKUK YHVNEKOHMRYMNFHNKSLQKCMWCYHVNEKOHMRYMNFHNKSLQK...
output:
241850
result:
ok single line: '241850'
Test #15:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
50 sDGRVCYifmZAqmOYpnWTLqfnRizJIMwSQchxDpObNtcmVSRKJEiEeZudZboihNcjFdWaICUzDzTmvaKKEBwDuYOWzfiFRikQZMXSWduEqOkLLRZZhWhrjGShJWqGxizpwjTAiexTOiaOzcwJwNFzUlnhzESfTyiRagvkinDZsvCZByLjkNkCpCkhqiKNFBRoHxxQSCExZoCInHXZrHBHmArdILZrFRVyWKbRYgLvdfGhLVcKtNiTCiDhUk yelwoozwcgtawcdhxipacbcutbtmkjptrzbemgfzrysrqm...
output:
95200
result:
ok single line: '95200'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
50 ztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjAp ennxgtMGiGyxBequmMabNsOYKpiKkhVIsikhsllQlYjzKo...
output:
33350
result:
ok single line: '33350'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
21 EFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHM uifuujeenafixjqlmkbgoezciuifuujeenafixjqlmkbgoezci AbbXNCiVLKPTEKvylrjiZxrfvjKCsfGgCNNstAWfhRIFWETkyQ QSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYV GWKJFJBWBRSYBTAAVSEKJZJEDBZGIAADRDBKUMVIJHBPOLOBFS VqHMNAFkcgVSVhCvpGEgTjxpiUBBXCNXtnvXKvKgbB...
output:
2825
result:
ok single line: '2825'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
21 JXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOG mgpsgjkqxuzhpwazpvotwnqylwunakrrkgbochohwzwlhrebzk UBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVR DVITHDVITHDVITHDVITHDVITHDVITHDVITHDVITHDVITHDVITH opghkabkuepopprkmjausdrquoqlmrsguzcpfnavylporfhbwo JXWQMGWKZSNBOYCIVXFEDXFZUKTQLBXCMKTKHTCBJB...
output:
1825
result:
ok single line: '1825'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
26 UpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSL KkzaskQqpfKkzaskQqpfKkzaskQqpfKkzaskQqpfKkzaskQqpf JHYHKWYVYAJHYHKWYVYAJHYHKWYVYAJHYHKWYVYAJHYHKWYVYA ewjohlvjvlyrojtzvqomydqzoewjohlvjvlyrojtzvqomydqzo BDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJ wijkheipmeoecqazlyphryisbggzvchrguoyasbkae...
output:
1775
result:
ok single line: '1775'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
27 ZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLP YbFxmGnjseibvMFCksGYgVzHiYbFxmGnjseibvMFCksGYgVzHi cCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJ lmmnklejxbiwtfxqzidtwwyqxsnzewkkqyoaqlxfxiavyrjxxo LIuNFmWnQbOaNoAzJURsdkGTkUeWubapxfdIYnAvySyUQIijIo UQSXADLZHXUQSXADLZHXUQSXADLZHXUQSXADLZHXUQ...
output:
3950
result:
ok single line: '3950'
Test #21:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
27 xjbfcuzfjgxjbfcuzfjgxjbfcuzfjgxjbfcuzfjgxjbfcuzfjg EGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSH fykmustwzvssdvudaknjtypsqrofxdlwzgqrsbxerirwyhlbxo IXSJNIETHETXAVEPCOSRUMZFXWCBLFOILVAASPNUZVBNVCISQN yxfehiqgpgyxfehiqgpgyxfehiqgpgyxfehiqgpgyxfehiqgpg EkSfRVjjDcFnJNlAkAzGPsueZkkeDCewOXvYlICrKi...
output:
11100
result:
ok single line: '11100'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
20 IKGCJPKNNAJLMDWTPIXVFIZRFIKGCJPKNNAJLMDWTPIXVFIZRF swuuccaljyswuuccaljyswuuccaljyswuuccaljyswuuccaljy pjxObFjPvtjMywWOddJXYOTEidcJfeUmqsuzsUiUMcQljTrMPl IOCHWhTlbErDAFymEJNfBLUKJPHpKxctjAXtDNCtifSgwkSBYh EfBBxdoVScEfBBxdoVScEfBBxdoVScEfBBxdoVScEfBBxdoVSc oGAyqeIoTOIAnTDuXyVKNvxqvjdtNnJXEoZXWNrbtX...
output:
1325
result:
ok single line: '1325'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
26 PMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWL AYZKROKQKHAYZKROKQKHAYZKROKQKHAYZKROKQKHAYZKROKQKH HOJUVSLAKUIMONKLUAVRSEKNWRBHDXAUVBIVMPYFBJGNHNSZIU whjazwhjazwhjazwhjazwhjazwhjazwhjazwhjazwhjazwhjaz ynkzfgwublufenpllzbjqcfwtkpqdmlcthxjmzldfderxaffcg XNQBTXNQBTXNQBTXNQBTXNQBTXNQBTXNQBTXNQBTXN...
output:
2375
result:
ok single line: '2375'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3552kb
input:
29 qquytemvannvipiuejkkxaisdqquytemvannvipiuejkkxaisd isjrhvdeudkmadpbpcxiatopiushonpczhrpkfspunfheyvrrj RSCIDVTVOFDIYQJRYFGNNWMPLRSCIDVTVOFDIYQJRYFGNNWMPL avxbuavxbuavxbuavxbuavxbuavxbuavxbuavxbuavxbuavxbu hotichahvhhotichahvhhotichahvhhotichahvhhotichahvh AUQEJOABAIDSRJJAPWTHXWKWEAGMMHTGVUQBAQAGTD...
output:
1325
result:
ok single line: '1325'
Test #25:
score: 0
Accepted
time: 0ms
memory: 3500kb
input:
25 jmrabxwkpcjmrabxwkpcjmrabxwkpcjmrabxwkpcjmrabxwkpc oqevowwniwjeksywxwbvjqffzoqevowwniwjeksywxwbvjqffz MRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDd SGZMCKNHCFTHGLXDUPNLHJJNBSGZMCKNHCFTHGLXDUPNLHJJNB XAALJXAALJXAALJXAALJXAALJXAALJXAALJXAALJXAALJXAALJ hkrfnhkrfnhkrfnhkrfnhkrfnhkrfnhkrfnhkrfnhk...
output:
2650
result:
ok single line: '2650'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
23 qawwoyukanccimgcogzcbgdalqawwoyukanccimgcogzcbgdal GCNEWEODIGGCNEWEODIGGCNEWEODIGGCNEWEODIGGCNEWEODIG BDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMX emltsfveboemltsfveboemltsfveboemltsfveboemltsfvebo efxpthxxudnjedltuanbnsbdjzlsbifpyjmfrayjlpseqessxv UGJILJGYEGUGJILJGYEGUGJILJGYEGUGJILJGYEGUG...
output:
1525
result:
ok single line: '1525'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
8 ACQACQ TUOQCG SMSBSMSB CKGHCKGH nhfunhfu TXBPOw eapedeaped svtvcs mwlmwl nHDyGnHDyG plmblzxq TCTTCT nmptti BNVBNV HOWmvnEd XVQdXVQd
output:
10
result:
ok single line: '10'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
7 ECXXIECXXI wdmfyvkgda nYqYlyXzfs DMTOCX yrmqyrmq gtwqnggi UIINEUIINE SnvtmSnvtm EFNVADIS sBhHGsBhHG TDDPEUOB dnOAdnOA LwbnuCzM WSXXWSXX
output:
10
result:
ok single line: '10'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
7 HMQHMQ JEBPURLC VVYFDL MTXMTX qdlxihgn MyZbMMyZbM kvikvi EXSEXS fEiKhWasQy sTirQsTirQ USEUSE eatleatl zxnfzxnf cvwlcvwl
output:
19
result:
ok single line: '19'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
7 FPYNNS padjgpadjg ngSooSVAUi ZOBLDV WpHWpH mkwymkwy wnpdkxha ipCreipCre TSbKJTSbKJ DBFKDBFK oftoxoftox AXPNAXPN akudakud arfuarfu
output:
41
result:
ok single line: '41'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3540kb
input:
9 qcXRld JBaDiV CWGLCWGL eyWeyW psvepsve UCndzUCndz VcBeVcBe LCiLCi FnBGFnBG wlymzt FWPNQFWPNQ NKEodR ZVZMKZVZMK iihyuiihyu jUSMijUSMi ZMTSFPFQ HDOHDO ttliyttliy
output:
13
result:
ok single line: '13'