結果

問題 No.318 学学学学学
ユーザー kuuso1kuuso1
提出日時 2015-12-12 21:57:17
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 363 ms / 2,000 ms
コード長 1,794 bytes
コンパイル時間 3,879 ms
コンパイル使用メモリ 108,724 KB
実行使用メモリ 52,716 KB
最終ジャッジ日時 2023-09-04 18:02:42
合計ジャッジ時間 10,513 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 87 ms
26,948 KB
testcase_01 AC 103 ms
30,896 KB
testcase_02 AC 110 ms
32,980 KB
testcase_03 AC 97 ms
32,124 KB
testcase_04 AC 107 ms
32,144 KB
testcase_05 AC 272 ms
51,652 KB
testcase_06 AC 363 ms
46,824 KB
testcase_07 AC 303 ms
40,616 KB
testcase_08 AC 262 ms
44,484 KB
testcase_09 AC 217 ms
44,752 KB
testcase_10 AC 163 ms
41,084 KB
testcase_11 AC 260 ms
52,716 KB
testcase_12 AC 213 ms
46,908 KB
testcase_13 AC 187 ms
44,608 KB
testcase_14 AC 179 ms
46,332 KB
testcase_15 AC 170 ms
44,816 KB
testcase_16 AC 157 ms
42,960 KB
testcase_17 AC 348 ms
41,020 KB
testcase_18 AC 187 ms
41,452 KB
testcase_19 AC 353 ms
42,888 KB
testcase_20 AC 149 ms
38,336 KB
testcase_21 AC 63 ms
21,512 KB
testcase_22 AC 65 ms
23,600 KB
testcase_23 AC 66 ms
21,716 KB
testcase_24 AC 67 ms
23,724 KB
testcase_25 AC 66 ms
21,712 KB
testcase_26 AC 65 ms
21,652 KB
testcase_27 AC 67 ms
23,584 KB
testcase_28 AC 67 ms
23,708 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int WD=300;
		int[] B=new int[N];
		int[] BP=new int[N/300+1];
		
		Dictionary<int,List<int>> D=new Dictionary<int,List<int>>();
		for(int i=0;i<N;i++){
			if(!D.ContainsKey(A[i]))D.Add(A[i],new List<int>());
			D[A[i]].Add(i);
		}
		var Keys=new List<int>(D.Keys);
		Keys.Sort();
		
		for(int t=0;t<Keys.Count;t++){
			int k=Keys[t];
			List<int> L=new List<int>();
			foreach(var j in D[k]){
				//if(B[j]==0 && BP[j/WD]==0){
					L.Add(j);
				//}
			}
			if(L.Count==0)continue;
			int left=L.Min();
			int right=L.Max();
			
			for(int i=left;i<=right;i++){
				if(i%WD==0 && i+WD<=right){
					BP[i/WD]=k;
					i+=WD-1;
					continue;
				}
				B[i]=k;
			}
		}
		/*for(int i=0;i<N;i++){
			Console.Write(i==0?"{0}":" {0}",Math.Max(B[i],BP[i/WD]));
		}*/
		var sb=new StringBuilder();
		for(int i=0;i<N;i++)sb.Append(String.Format(i==0?"{0}":" {0}",Math.Max(B[i],BP[i/WD])));
		Console.WriteLine(sb.ToString());
		
		
	}
	int N;
	int[] A;
	public Sol(){
		N=ri();
		A=ria();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0