結果

問題 No.694 square1001 and Permutation 3
ユーザー ekidenpekidenp
提出日時 2018-06-09 00:18:07
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 681 bytes
コンパイル時間 3,558 ms
コンパイル使用メモリ 101,900 KB
実行使用メモリ 32,760 KB
最終ジャッジ日時 2023-09-13 00:53:43
合計ジャッジ時間 8,996 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
20,748 KB
testcase_01 AC 55 ms
20,776 KB
testcase_02 AC 54 ms
20,724 KB
testcase_03 AC 58 ms
22,728 KB
testcase_04 AC 58 ms
20,636 KB
testcase_05 AC 59 ms
20,688 KB
testcase_06 AC 59 ms
20,620 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string str = Console.ReadLine();
		long N = long.Parse(str);
		long[] A = new long[N];
		for(var i=0;i<N;i++){
			string str2 = Console.ReadLine();
			A[i] = long.Parse(str2);
		}
		long cnt = 0;
		long[] C = new long[N];
		long[] C2 = new long[N];
		for(var i=0;i<N;i++){
			C2[i] = N-1;
			for(var j=0;j<N;j++){
				if(A[i] > A[j]){
					C[i] += 1;
					if(j > i){
						cnt += 1;
					}
				} else if(A[i] < A[j]){
					C2[i] -= 1;
				}
			}
		}
		Console.WriteLine(cnt);
		for(var i=1;i<N;i++){
			cnt = cnt - (C[i-1]) + (N - 1- C2[i-1]);
			Console.WriteLine(cnt);
		}
	}
}
0