Submission #37611040


Source Code Expand

import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		// 入力
		int N = sc.nextInt();
		int[] A = new int[N + 1];
		for (int i = 1; i <= N; i++) A[i] = sc.nextInt();

		// 配列 T の作成・重複を消す
		HashSet<Integer> tmp = new HashSet<Integer>();
		for (int i = 1; i <= N; i++) tmp.add(A[i]);
		ArrayList<Integer> T = new ArrayList<>(tmp);
		Collections.sort(T);

		// 答えを求める
		int[] B = new int[N + 1];
		for (int i = 1; i <= N; i++) {
			B[i] = Collections.binarySearch(T, A[i]);
			B[i] += 1;
		}

		// 答えを空白区切りで出力
		for (int i = 1; i <= N; i++) {
			if (i >= 2) System.out.print(" ");
			System.out.print(B[i]);
		}
		System.out.println();
	}
};

Submission Info

Submission Time
Task A15 - Compression
User masakore
Language Java (OpenJDK 11.0.6)
Score 1000
Code Size 791 Byte
Status AC
Exec Time 992 ms
Memory 60436 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 1000 / 1000
Status
AC × 1
AC × 21
Set Name Test Cases
Sample sample_01.txt
All 10_random_small_00.txt, 10_random_small_01.txt, 10_random_small_02.txt, 10_random_small_03.txt, 10_random_small_04.txt, 10_random_small_05.txt, 10_random_small_06.txt, 10_random_small_07.txt, 10_random_small_08.txt, 10_random_small_09.txt, 20_random_large_00.txt, 20_random_large_01.txt, 20_random_large_02.txt, 20_random_large_03.txt, 20_random_large_04.txt, 20_random_large_05.txt, 20_random_large_06.txt, 20_random_large_07.txt, 20_random_large_08.txt, 20_random_large_09.txt, sample_01.txt
Case Name Status Exec Time Memory
10_random_small_00.txt AC 125 ms 35824 KiB
10_random_small_01.txt AC 120 ms 35820 KiB
10_random_small_02.txt AC 107 ms 35524 KiB
10_random_small_03.txt AC 109 ms 35728 KiB
10_random_small_04.txt AC 104 ms 35468 KiB
10_random_small_05.txt AC 119 ms 35876 KiB
10_random_small_06.txt AC 109 ms 35876 KiB
10_random_small_07.txt AC 103 ms 35468 KiB
10_random_small_08.txt AC 119 ms 36084 KiB
10_random_small_09.txt AC 114 ms 35928 KiB
20_random_large_00.txt AC 443 ms 56012 KiB
20_random_large_01.txt AC 602 ms 58440 KiB
20_random_large_02.txt AC 591 ms 57148 KiB
20_random_large_03.txt AC 992 ms 58824 KiB
20_random_large_04.txt AC 585 ms 57332 KiB
20_random_large_05.txt AC 882 ms 59564 KiB
20_random_large_06.txt AC 961 ms 59036 KiB
20_random_large_07.txt AC 598 ms 57832 KiB
20_random_large_08.txt AC 897 ms 60024 KiB
20_random_large_09.txt AC 931 ms 60436 KiB
sample_01.txt AC 106 ms 35788 KiB