結果

問題 No.365 ジェンガソート
ユーザー #ラス+#ラス+
提出日時 2019-10-10 16:47:51
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,561 bytes
コンパイル時間 1,677 ms
コンパイル使用メモリ 59,832 KB
実行使用メモリ 29,864 KB
最終ジャッジ日時 2023-08-13 17:28:41
合計ジャッジ時間 6,477 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
29,864 KB
testcase_01 AC 58 ms
18,752 KB
testcase_02 AC 58 ms
20,636 KB
testcase_03 AC 58 ms
22,792 KB
testcase_04 AC 59 ms
22,776 KB
testcase_05 WA -
testcase_06 AC 58 ms
18,732 KB
testcase_07 AC 59 ms
20,688 KB
testcase_08 WA -
testcase_09 AC 58 ms
20,720 KB
testcase_10 AC 59 ms
20,684 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 TLE -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.IO;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
class Start{
  static void Solve(){
    var n=int.Parse(ReadLine());
    var a=new List<int>();
    var k=ReadLine().Split();
    for(int i=n-1;i>=0;i--)a.Add(int.Parse(k[i]));
    var ans=0;
    while(true){
      var max=-1;
      var i=1;
      var oldi=0;
      var j=0;
      while(i!=a.Count){
        if(a[i]>a[oldi]&&a[oldi]>max){
          j=oldi;
          max=a[oldi];
        }
        if(a[i]!=-1)oldi=i;
        i++;
      }
      if(max==-1)break;
      ans++;
      a[j]=-1;
      a.Add(max);
    }
    WriteLine(ans);
  }
  static void Main(){
    var sw=new StreamWriter(OpenStandardOutput()){AutoFlush=false};
    SetOut(sw);
    Solve();
    Out.Flush();
  }
  const long MOD=1000000007L;
  static void Swap<T>(ref T a,ref T b){T c=a;a=b;b=c;}
}
class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T F;
    public U S;
    public Pair(T v1, U v2) {
        this.F = v1;
        this.S = v2;
    }
    public int CompareTo(Pair<T, U> a) => F.CompareTo(a.F) != 0 ? F.CompareTo(a.F) : S.CompareTo(a.S);
    public override string ToString() => F + " " + S;
}
/*class Pair<T1, T2> : IComparable<Pair<T1, T2>> where T1 : IComparable<T1> where T2 : IComparable<T2>
{
  public T1 F;public T2 S;
  public Pair(T1 f,T2 s){F=f;S=s;}
  public long CompareTo(Pair<T1,T2> p)=>F.CompareTo(p.F)!=0?F.CompareTo(p.F):S.CompareTo(p.S);
  public override string ToString()=>F+" "+S;
}*/
0