結果
| 問題 |
No.694 square1001 and Permutation 3
|
| コンテスト | |
| ユーザー |
ekidenp
|
| 提出日時 | 2018-06-08 23:07:41 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 678 bytes |
| コンパイル時間 | 855 ms |
| コンパイル使用メモリ | 108,940 KB |
| 実行使用メモリ | 37,772 KB |
| 最終ジャッジ日時 | 2024-06-30 11:00:10 |
| 合計ジャッジ時間 | 6,102 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 1 |
| other | WA * 7 TLE * 1 -- * 5 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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];
for(var i=0;i<N/2;i++){
cnt += A[i]-1;
for(var j=i-1;j>=0;j--){
if(A[i] > A[j]){
cnt -= 1;
}
}
}
for(var i=N/2;i<N;i++){
for(var j=i+1;j<N;j++){
if(A[i] > A[j]){
cnt += 1;
}
}
}
Console.WriteLine(cnt);
for(var i=1;i<N;i++){
cnt = cnt - (A[i-1]-1) + (N - A[i-1]);
Console.WriteLine(cnt);
}
}
}
ekidenp