QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#60959#3513. Assessing GenomesSa3tElSefr#AC ✓3ms3460kbC++232.4kb2022-11-08 21:31:262022-11-08 21:31:29

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-08 21:31:29]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3460kb
  • [2022-11-08 21:31:26]
  • 提交

answer

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>

// #pragma GCC optimize("O3")
// #pragma GCC optimize ("unroll-loops")
// #pragma GCC target("avx,avx2,fma")

using namespace std;

#define ll long long
#define ld long double

typedef complex<ld> point;

#define polar(r, t) ((r)*exp(point(0, (t))))
#define length(a) (hypot((a).imag(), (a).real()))
#define rotate(v, t) (polar(v, t))
#define X real()
#define Y imag()
#define cp(a, b) ((conj(a) * (b)).imag())
#define EPS 1e-13
// #define M_PI acosl(-1.0l)

const int N = 1e6 + 5, lg = 19, mod = 998244353;
const int M = 1e7 + 5;

int n;

bool fold(string &s, int k) {
    if (s.size() % k) {
        return false;
    }
    string sub = s.substr(0, k);
    for (int i = k; i < s.size(); i += k) {
        if (s.substr(i, k) != sub) {
            return false;
        }
    }
    return true;
}

int score(string &s) {
    for (int k = 1; k <= s.size(); ++k) {
        if (fold(s, k)) {
            return k;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        a[i] = score(s);
    }
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        b[i] = score(s);
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += (a[i] - b[i]) * (a[i] - b[i]);
    }
    cout << ans << '\n';
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3448kb

input:

2
TTTTTT
TATG
TATATA
AAAGAAAG

output:

1

result:

ok single line: '1'

Test #2:

score: 0
Accepted
time: 2ms
memory: 3392kb

input:

3
abcdef
aaa
bab
AbAb
xyzxyz
X

output:

10

result:

ok single line: '10'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3332kb

input:

50
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 3ms
memory: 3288kb

input:

50
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb...

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Accepted
time: 3ms
memory: 3364kb

input:

50
abababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababababab
bcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbcbc...

output:

0

result:

ok single line: '0'

Test #6:

score: 0
Accepted
time: 2ms
memory: 3456kb

input:

1
aba
x

output:

4

result:

ok single line: '4'

Test #7:

score: 0
Accepted
time: 3ms
memory: 3404kb

input:

50
hbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcakhbvhlbwfpdwmwxijsbbfjbcak
xkhktuzqejivxjyqdgxwgxfptugwdjsxmsfecelafxgtrv...

output:

17425

result:

ok single line: '17425'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3384kb

input:

50
jyownbbxucekrpmqvygmvnhvcboaysqqqygfblgorlngnoxidywmvmzdlyekraxsoaupzzhnroadarirkjlkleahfbvdzyerfahcwwxyuudvprecjrtqpkpouvbimtydmkwkgoesntizfaqxunkrrkpopbvhbzrlkpqafgdqiprvtjwwcjgbcjesvauiphdpxezwofmuuctlqknbnwbggawjnroesrqnjxrfdckrbhxgwtcjvkdxcedaai
kdutukdutukdutukdutukdutukdutukdutukdutukdutuk...

output:

72150

result:

ok single line: '72150'

Test #9:

score: 0
Accepted
time: 2ms
memory: 3336kb

input:

50
wajcsgssmwpbzljnvqjnbpuzfkqiviftgmsnnyaodckukayihynxsshefxtchgjwsmhjfuqsqpjcaacfphfxnjhlnmywtbuadvynxnqiaxyxxodgqjigepqxhzqhvvshyoozvvxipftmcufbzqqeyjbgpqncqfefsrqdclpypbkqnnqungmdmhxsgxdeqdcxorvmtypsljamiposypjfkbdnypnjsaazcmpttudyojekendpxqnwnhnkto
aQzTNvYddoPOBqxGlWWAxmovmaQzTNvYddoPOBqxGlWWAx...

output:

50025

result:

ok single line: '50025'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3456kb

input:

50
ZNVWEBXZTBFFCUMYVLAEVAHCOLSVERPRHDQLECQLIXKTDHNJNCNUBMAXVXFAELLXOXICMCGZESVBVZHFVIPKGGGXHAOJTDXTCPYZKSDWBASFQFMMMXTVNHSRKTHLRDVCUSSTPQRHRTAVRBIPHGWKDJWSKAEEGHWFTPDHTATFLXSAXDTDCCWSYSTQHIBWNQRPZWUMGXCEVHYSQKKPFSQLBAZUZFOQFYEDHSZDXJKOPSAONWOKHLDHTDOGGX
ornijzqqwdkqwnpokecffotwwilggslmxfhfjtgnwblimm...

output:

175875

result:

ok single line: '175875'

Test #11:

score: 0
Accepted
time: 2ms
memory: 3328kb

input:

50
egftescorktaaqihwjavbrwguynrluxfhsuiabezawrfsmammhapeebzvvmooxusvkzrqfmvstrgkuojxjiszlahgkakjyreaymhhmtakwengrqhekvfczfyvwmrulmkwkzfmtewjrvuwjjtmjsutgyofrtkgwyvjbnrcuxozhfgddgyozsafswmlihhsjmfxvyjwbfjmjrevjpjrqekysrdffryqdwxljjtivgymroobmqwujhbxwoasc
pufvwgqtizcvpzcagbvhhvkcezrhgxoknpolhghmkoimmm...

output:

76075

result:

ok single line: '76075'

Test #12:

score: 0
Accepted
time: 3ms
memory: 3380kb

input:

50
DIWYKNELNHZDZMXMSNXGUROBAPAKEPWBKACAYXGBTVQJSZYBHBMXLIZLSDHSZBAYXXNDUYQOGKZWOWLVENJXYNIHKQWFKZIHWLVWMADESAIHXLHKIJFKOFVBQXWCYQIYSBGKCVOJWVIMXAHFEHEEETIQDVRSKMQJIWKXJTNDPRGPOSYPLOTFIKRNWCJPNEREGMQWJCLPJPYAEUCPXESALXMWBYCPLNPHCCPIDPGWSZOMFGTYRJOYPBDCXG
NQTLOQRJZGSEBFKQROFDZDKVQNQTLOQRJZGSEBFKQROFDZ...

output:

142700

result:

ok single line: '142700'

Test #13:

score: 0
Accepted
time: 3ms
memory: 3268kb

input:

50
AIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNTAIJKDSFASGTOXKJPZANETQWNT
rfzpprfzpprfzpprfzpprfzpprfzpprfzpprfzpprfzppr...

output:

171100

result:

ok single line: '171100'

Test #14:

score: 0
Accepted
time: 3ms
memory: 3456kb

input:

50
MAUDPQDGLAPKTHPTXLMKTCQRJXFANZLYSYCPWVHEFORTNEWFSTVJDAPDIEOCUFCDLIJZHYPAPGFUJAGDECXBJNWCDPLAXLEHEXNHHSISXLXHWUMLFETSTLRSUNCCNWLAOTDKBITFMUMKMDRJAJJRDSFTNJKIBNRYYWEEMZELJRACBRYPKDFKQAXLBZCXSDWYISZIYBPYJTEAFGVJZYEGKPDWZOGSIXJHIHWITOQMFYJGGDQZRXSPRXQKUK
YHVNEKOHMRYMNFHNKSLQKCMWCYHVNEKOHMRYMNFHNKSLQK...

output:

241850

result:

ok single line: '241850'

Test #15:

score: 0
Accepted
time: 2ms
memory: 3344kb

input:

50
sDGRVCYifmZAqmOYpnWTLqfnRizJIMwSQchxDpObNtcmVSRKJEiEeZudZboihNcjFdWaICUzDzTmvaKKEBwDuYOWzfiFRikQZMXSWduEqOkLLRZZhWhrjGShJWqGxizpwjTAiexTOiaOzcwJwNFzUlnhzESfTyiRagvkinDZsvCZByLjkNkCpCkhqiKNFBRoHxxQSCExZoCInHXZrHBHmArdILZrFRVyWKbRYgLvdfGhLVcKtNiTCiDhUk
yelwoozwcgtawcdhxipacbcutbtmkjptrzbemgfzrysrqm...

output:

95200

result:

ok single line: '95200'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3348kb

input:

50
ztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjApztFGcSRTgkxsJqEGMVrPOILGVfvZUlYmSMCaCyiHTbTfwERjAp
ennxgtMGiGyxBequmMabNsOYKpiKkhVIsikhsllQlYjzKo...

output:

33350

result:

ok single line: '33350'

Test #17:

score: 0
Accepted
time: 2ms
memory: 3332kb

input:

21
EFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHMEFAHM
uifuujeenafixjqlmkbgoezciuifuujeenafixjqlmkbgoezci
AbbXNCiVLKPTEKvylrjiZxrfvjKCsfGgCNNstAWfhRIFWETkyQ
QSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYVQSJYV
GWKJFJBWBRSYBTAAVSEKJZJEDBZGIAADRDBKUMVIJHBPOLOBFS
VqHMNAFkcgVSVhCvpGEgTjxpiUBBXCNXtnvXKvKgbB...

output:

2825

result:

ok single line: '2825'

Test #18:

score: 0
Accepted
time: 2ms
memory: 3276kb

input:

21
JXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOGJXXOG
mgpsgjkqxuzhpwazpvotwnqylwunakrrkgbochohwzwlhrebzk
UBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVRUBLVR
DVITHDVITHDVITHDVITHDVITHDVITHDVITHDVITHDVITHDVITH
opghkabkuepopprkmjausdrquoqlmrsguzcpfnavylporfhbwo
JXWQMGWKZSNBOYCIVXFEDXFZUKTQLBXCMKTKHTCBJB...

output:

1825

result:

ok single line: '1825'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3460kb

input:

26
UpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSLUpNSL
KkzaskQqpfKkzaskQqpfKkzaskQqpfKkzaskQqpfKkzaskQqpf
JHYHKWYVYAJHYHKWYVYAJHYHKWYVYAJHYHKWYVYAJHYHKWYVYA
ewjohlvjvlyrojtzvqomydqzoewjohlvjvlyrojtzvqomydqzo
BDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJBDHOJ
wijkheipmeoecqazlyphryisbggzvchrguoyasbkae...

output:

1775

result:

ok single line: '1775'

Test #20:

score: 0
Accepted
time: 2ms
memory: 3268kb

input:

27
ZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLPZVRLP
YbFxmGnjseibvMFCksGYgVzHiYbFxmGnjseibvMFCksGYgVzHi
cCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJcCpdJ
lmmnklejxbiwtfxqzidtwwyqxsnzewkkqyoaqlxfxiavyrjxxo
LIuNFmWnQbOaNoAzJURsdkGTkUeWubapxfdIYnAvySyUQIijIo
UQSXADLZHXUQSXADLZHXUQSXADLZHXUQSXADLZHXUQ...

output:

3950

result:

ok single line: '3950'

Test #21:

score: 0
Accepted
time: 2ms
memory: 3380kb

input:

27
xjbfcuzfjgxjbfcuzfjgxjbfcuzfjgxjbfcuzfjgxjbfcuzfjg
EGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSHEGQSH
fykmustwzvssdvudaknjtypsqrofxdlwzgqrsbxerirwyhlbxo
IXSJNIETHETXAVEPCOSRUMZFXWCBLFOILVAASPNUZVBNVCISQN
yxfehiqgpgyxfehiqgpgyxfehiqgpgyxfehiqgpgyxfehiqgpg
EkSfRVjjDcFnJNlAkAzGPsueZkkeDCewOXvYlICrKi...

output:

11100

result:

ok single line: '11100'

Test #22:

score: 0
Accepted
time: 2ms
memory: 3272kb

input:

20
IKGCJPKNNAJLMDWTPIXVFIZRFIKGCJPKNNAJLMDWTPIXVFIZRF
swuuccaljyswuuccaljyswuuccaljyswuuccaljyswuuccaljy
pjxObFjPvtjMywWOddJXYOTEidcJfeUmqsuzsUiUMcQljTrMPl
IOCHWhTlbErDAFymEJNfBLUKJPHpKxctjAXtDNCtifSgwkSBYh
EfBBxdoVScEfBBxdoVScEfBBxdoVScEfBBxdoVScEfBBxdoVSc
oGAyqeIoTOIAnTDuXyVKNvxqvjdtNnJXEoZXWNrbtX...

output:

1325

result:

ok single line: '1325'

Test #23:

score: 0
Accepted
time: 2ms
memory: 3376kb

input:

26
PMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWLPMCWL
AYZKROKQKHAYZKROKQKHAYZKROKQKHAYZKROKQKHAYZKROKQKH
HOJUVSLAKUIMONKLUAVRSEKNWRBHDXAUVBIVMPYFBJGNHNSZIU
whjazwhjazwhjazwhjazwhjazwhjazwhjazwhjazwhjazwhjaz
ynkzfgwublufenpllzbjqcfwtkpqdmlcthxjmzldfderxaffcg
XNQBTXNQBTXNQBTXNQBTXNQBTXNQBTXNQBTXNQBTXN...

output:

2375

result:

ok single line: '2375'

Test #24:

score: 0
Accepted
time: 2ms
memory: 3408kb

input:

29
qquytemvannvipiuejkkxaisdqquytemvannvipiuejkkxaisd
isjrhvdeudkmadpbpcxiatopiushonpczhrpkfspunfheyvrrj
RSCIDVTVOFDIYQJRYFGNNWMPLRSCIDVTVOFDIYQJRYFGNNWMPL
avxbuavxbuavxbuavxbuavxbuavxbuavxbuavxbuavxbuavxbu
hotichahvhhotichahvhhotichahvhhotichahvhhotichahvh
AUQEJOABAIDSRJJAPWTHXWKWEAGMMHTGVUQBAQAGTD...

output:

1325

result:

ok single line: '1325'

Test #25:

score: 0
Accepted
time: 2ms
memory: 3364kb

input:

25
jmrabxwkpcjmrabxwkpcjmrabxwkpcjmrabxwkpcjmrabxwkpc
oqevowwniwjeksywxwbvjqffzoqevowwniwjeksywxwbvjqffz
MRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDdMRUDd
SGZMCKNHCFTHGLXDUPNLHJJNBSGZMCKNHCFTHGLXDUPNLHJJNB
XAALJXAALJXAALJXAALJXAALJXAALJXAALJXAALJXAALJXAALJ
hkrfnhkrfnhkrfnhkrfnhkrfnhkrfnhkrfnhkrfnhk...

output:

2650

result:

ok single line: '2650'

Test #26:

score: 0
Accepted
time: 2ms
memory: 3288kb

input:

23
qawwoyukanccimgcogzcbgdalqawwoyukanccimgcogzcbgdal
GCNEWEODIGGCNEWEODIGGCNEWEODIGGCNEWEODIGGCNEWEODIG
BDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMXBDFMX
emltsfveboemltsfveboemltsfveboemltsfveboemltsfvebo
efxpthxxudnjedltuanbnsbdjzlsbifpyjmfrayjlpseqessxv
UGJILJGYEGUGJILJGYEGUGJILJGYEGUGJILJGYEGUG...

output:

1525

result:

ok single line: '1525'

Test #27:

score: 0
Accepted
time: 2ms
memory: 3268kb

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: 2ms
memory: 3260kb

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: 2ms
memory: 3448kb

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: 3328kb

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: 2ms
memory: 3448kb

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'