結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
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()))
    print("-" * 10)

    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