1749: [NewOJ Contest 6] 二维逆序对

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:53 通过:22

题目描述

逆序对:在一个数组中,如果第i个元素大于第j个元素,其中i小于j,则i和j构成一个逆序对。
例如abc的逆序对数量为0,cba的逆序对数量为3。
现在给你一个50*50的字母数组,请你求出每一行的逆序对数量之和+每一列的逆序对数量之和+二维逆序对数量
在本题中,二维逆序对定义为:一个左上角元素a[i][j]大于右下角的元素a[ii][jj],其中满足i<ii,j<jj。

输入格式

无输入,给定的50*50的字符数组在样例输入中。

输出格式

输出一个整数表示答案。

输入样例 复制

phqghumeaylnlfdxfircvscxggbwkfnqduxwfnfozvsrtkjpre
pggxrpnrvystmwcysyycqpevikeffmznimkkasvwsrenzkycxf
xtlsgypsfadpooefxzbcoejuvpvaboygpoeylfpbnpljvrvipy
amyehwqnqrqpmxujjloovaowuxwhmsncbxcoksfzkvatxdknly
jyhfixjswnkkufnuxxzrzbmnmgqooketlyhnkoaugzqrcddiut
eiojwayyzpvscmpsajlfvgubfaaovlzylntrkdcpwsrtesjwhd
izcobzcnfwlqijtvdwvxhrcbldvgylwgbusbmborxtlhcsmpxo
hgmgnkeufdxotogbgxpeyanfetcukepzshkljugggekjdqzjen
pevqgxiepjsrdzjazujllchhbfqmkimwzobiwybxduunfsksrs
rtekmqdcyzjeeuhmsrqcozijipfioneeddpszrnavymmtatbdz
qsoemuvnpppsuacbazuxmhecthlegrpunkdmbppweqtgjoparm
owzdqyoxytjbbhawdydcprjbxphoohpkwqyuhrqzhnbnfuvqnq
qlrzjpxiogvliexdzuzosrkrusvojbrzmwzpowkjilefraamdi
gpnpuuhgxpqnjwjmwaxxmnsnhhlqqrzudltfzotcjtnzxuglsd
smzcnockvfajfrmxothowkbjzwucwljfrimpmyhchzriwkbarx
bgfcbceyhjugixwtbvtrehbbcpxifbxvfbcgkcfqckcotzgkub
mjrmbsztsshfroefwsjrxjhguzyupzwweiqurpixiqflduuveo
owqcudhnefnjhaimuczfskuiduburiswtbrecuykabfcvkdzez
toidukuhjzefczzzbfkqdpqzikfobucdhthxdjgkjelrlpaxam
ceroswitdptpcclifkeljytihrcqaybnefxnxvgzedyyhngycd
rudmphmeckotrwospofghfozqvlqfxwwkmfxdyygmdcaszsgov
sodkjghcwmbmxrmhuyfyqgajqkcklznayxqkqoyzwmyubzazcp
khktkydzivcuypurfmbisgekyrgzvxdhpoamvafyrarxsvkhtq
dihersigbhzjzujxmmyspnaraewkegjccvhhrjvbjtsqdjootg
pknfpfycgfieowqrwwwpzsqmetogepspxnvjiupalyynmkmnuv
klhsecdwracgfmzkgipdfodkjmjqwiqpuoqhimvfvuzwyvijgf
ullkjduhsjafbtlkmfqrmyjfjnhhssqctydteamdcjbprhtneg
yiwxgcjwlgrsmeaearwtvjsjbaoiojlwhypnvruihoswkifygt
ydhacwyhsgewzmtgonzltjhgauhnihreqgjfwkjsmtpjhaefqz
aauldrchjccdyrfvvrivuyeegfivdrcygurqdredakubnfgupr
oqylobcwqxkzmausjgmhcmhgdnmphnqkamhurktrffaclvgrzk
kldacllteojomonxrqyjzginrnnzwacxxaedrwudxzrfusewjt
boxvynfhkstcenaumnddxfdmvzcautdcckxaaydzsxttobbgqn
gvvpjgojoglmkxgbfcpypckqchbddzwrxbzmqrlxvobtwhxgin
fgfrcclmznmjugwwbsqfcihubsjollmsqsghmcphelsotflbgs
fnpcuzsrupchynvzhcpqugriwniqxdfjpwpxfblkpnpeelfjmt
kuqpzomwnlmbupmktlptndmpdsydsgvfpenemwborifsuqhces
kmkhssmvnonwafxwhgbibabvqopqfoviussqfqwehtxdzujtln
txmrjxxwtlggkytbiolydnilqadojskkvfxahhjmbocljarint
dwcldvdxropbyjzwyyojuothwmlvrglfzdzdbtubxuoffvncrs
wsaznmoijoivvgobqpnckwvnhkebmtdhvygkjisuxhatmuudqb
hmknhfxaxqxkjlzzqtsjfaeedfuujkolxjoqkdvfepvlhvhrwt
fdukxffjpsswyxlijjhevryxozbafpfmowgrgonuatdqlahygg
yljddjhmltedzlodsrkeutgtnkntarjkpxinovgzdthunwooxv
jjmpsvknhkwjopmmlebksucvzqlyqnwcmbvbhrmlowpjbwyvwt
gtoqnmicxapzarknnxtuufarzrosdqwsmtcjghecqudosrtjxy
aaykqrxycrxuwjxnpqjnbkcpdmokalxapemvbqlzsvxzkutapp
wgzpdpyzkzcvbntcvfxsxpjaoxtfhvxxytgokrcxaetauqgndm
phwzyiayabjrqgeppxyjsttyzuvldvybsuxkbmfzvrtnovidzn
pghozvafmsnsnqivmvubcwtfsrqtmknepbhowejazhkwcmmtpi

输出样例 复制