結果

問題 No.318 学学学学学
ユーザー kuuso1kuuso1
提出日時 2015-12-11 23:44:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 542 ms / 2,000 ms
コード長 1,639 bytes
コンパイル時間 4,259 ms
コンパイル使用メモリ 107,356 KB
実行使用メモリ 49,272 KB
最終ジャッジ日時 2023-09-04 17:46:59
合計ジャッジ時間 14,453 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
22,972 KB
testcase_01 AC 138 ms
30,260 KB
testcase_02 AC 149 ms
32,072 KB
testcase_03 AC 126 ms
29,476 KB
testcase_04 AC 141 ms
29,472 KB
testcase_05 AC 467 ms
49,184 KB
testcase_06 AC 539 ms
46,848 KB
testcase_07 AC 485 ms
43,620 KB
testcase_08 AC 454 ms
42,720 KB
testcase_09 AC 405 ms
40,676 KB
testcase_10 AC 352 ms
38,976 KB
testcase_11 AC 466 ms
49,272 KB
testcase_12 AC 402 ms
46,944 KB
testcase_13 AC 379 ms
43,684 KB
testcase_14 AC 375 ms
40,648 KB
testcase_15 AC 362 ms
40,616 KB
testcase_16 AC 347 ms
36,936 KB
testcase_17 AC 542 ms
44,872 KB
testcase_18 AC 372 ms
43,500 KB
testcase_19 AC 519 ms
42,856 KB
testcase_20 AC 362 ms
35,956 KB
testcase_21 AC 65 ms
21,440 KB
testcase_22 AC 65 ms
21,848 KB
testcase_23 AC 63 ms
21,664 KB
testcase_24 AC 69 ms
21,720 KB
testcase_25 AC 69 ms
21,788 KB
testcase_26 AC 67 ms
21,708 KB
testcase_27 AC 67 ms
19,740 KB
testcase_28 AC 69 ms
19,616 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]));
		}
		
		
		
		
	}
	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