結果

問題 No.694 square1001 and Permutation 3
ユーザー kerotonokerotono
提出日時 2018-06-08 23:06:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 606 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 27,832 KB
最終ジャッジ日時 2023-09-13 00:11:17
合計ジャッジ時間 5,379 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 38 ms
7,796 KB
testcase_06 AC 38 ms
7,760 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!python
# -*- coding: utf-8 -*-


def main():
    N = int(input())
    A = []
    for i in range(N):
        A.append(int(input()))

    cnt = 0
    for k in range(N):
        if k == 0:
            V = A[k:] + A[:k]
            for i in range(1, N):
                for j in range(i):
                    if V[i] < V[j]:
                        cnt += 1
        else:
            for i in range(1, N):
                if V[i] < V[0]:
                    cnt -= 1
                else:
                    cnt += 1
            V.append(V.pop(0))
        print(cnt)


if __name__ == '__main__':
    main()
0