結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー kuuso1kuuso1
提出日時 2016-05-22 17:04:03
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 416 ms / 1,000 ms
コード長 1,099 bytes
コンパイル時間 975 ms
コンパイル使用メモリ 106,624 KB
実行使用メモリ 43,904 KB
最終ジャッジ日時 2024-04-16 12:16:55
合計ジャッジ時間 20,606 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
18,304 KB
testcase_01 AC 27 ms
17,792 KB
testcase_02 AC 27 ms
18,048 KB
testcase_03 AC 397 ms
43,648 KB
testcase_04 AC 403 ms
39,040 KB
testcase_05 AC 410 ms
38,784 KB
testcase_06 AC 408 ms
38,656 KB
testcase_07 AC 406 ms
38,784 KB
testcase_08 AC 406 ms
38,656 KB
testcase_09 AC 403 ms
38,912 KB
testcase_10 AC 416 ms
38,784 KB
testcase_11 AC 408 ms
43,776 KB
testcase_12 AC 400 ms
43,648 KB
testcase_13 AC 398 ms
43,904 KB
testcase_14 AC 400 ms
43,904 KB
testcase_15 AC 399 ms
43,648 KB
testcase_16 AC 398 ms
43,264 KB
testcase_17 AC 401 ms
43,008 KB
testcase_18 AC 409 ms
42,496 KB
testcase_19 AC 399 ms
42,880 KB
testcase_20 AC 393 ms
42,240 KB
testcase_21 AC 399 ms
42,368 KB
testcase_22 AC 407 ms
42,240 KB
testcase_23 AC 389 ms
42,240 KB
testcase_24 AC 394 ms
43,008 KB
testcase_25 AC 397 ms
42,752 KB
testcase_26 AC 401 ms
42,624 KB
testcase_27 AC 383 ms
42,496 KB
testcase_28 AC 394 ms
42,496 KB
testcase_29 AC 399 ms
42,368 KB
testcase_30 AC 391 ms
42,240 KB
testcase_31 AC 399 ms
42,368 KB
testcase_32 AC 395 ms
42,240 KB
testcase_33 AC 399 ms
41,984 KB
testcase_34 AC 392 ms
41,984 KB
testcase_35 AC 388 ms
41,728 KB
testcase_36 AC 389 ms
41,472 KB
testcase_37 AC 388 ms
41,344 KB
testcase_38 AC 397 ms
41,472 KB
testcase_39 AC 390 ms
41,344 KB
testcase_40 AC 392 ms
41,216 KB
testcase_41 AC 29 ms
17,792 KB
testcase_42 AC 27 ms
18,176 KB
testcase_43 AC 28 ms
17,792 KB
testcase_44 AC 63 ms
20,608 KB
testcase_45 AC 59 ms
20,480 KB
testcase_46 AC 60 ms
20,480 KB
testcase_47 AC 331 ms
39,680 KB
testcase_48 AC 314 ms
41,600 KB
testcase_49 AC 337 ms
41,216 KB
testcase_50 AC 408 ms
40,704 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

class TEST{
	static void Main(){
		var d = ria();
		int N = d[0];
		int M = d[1];
		long[] A = rla();
		long[] B = rla();
		
		int[] C = new int[N+2];
		long[] D = new long[N+2];
		for(int i=0;i<N+2;i++)D[i] = (long)1e18;
		D[0] = -1;
		
		int ptr = 0;
		long bak = -1;
		Array.Sort(A);
		for(int i=0;i<N;i++){
			if( bak != A[i] ){
				ptr++;
				D[ptr] = A[i];
				bak = A[i];
			}
		}
		ptr = 1;
		for(int i=0;i<N;i++){
			if( D[ptr] != A[i]){
				ptr++;
			}
			C[ptr]++;
		}
		
		for(int i=0;i<M;i++){
			
			int l = 0;
			int r = ptr+1;
			int c = 0;
			
			int ret = 0;
			
			while(r-l>1){
				c = (l+r)/2;
				if(D[c]<B[i]){
					l = c;
				}else{
					r = c;
				}
			}
			while( c>0 && D[c]>=B[i] )c--;
			while( c<ptr && D[c]<B[i] )c++;
			
			ret = 0;
			if(D[c] == B[i]) ret = C[c];
			Console.Write(i==0?"{0}":" {0}",ret);
		}
		Console.WriteLine();
	}
	
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
}
0