Submission #44257655


Source Code Expand

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			int p1 = scanner.nextInt();
			int max = -1;
			for (int i = 1; i < n; i++) {
				int p = scanner.nextInt();
				if (max < p) {
					max = p;
				}
			}

			if (p1 > max) {
				System.out.println(0);
			} else {
				System.out.println(max - p1 + 1);
			}
		}
	}
}

Submission Info

Submission Time
Task A - To Be Saikyo
User kmatsu
Language Java (OpenJDK 11.0.6)
Score 100
Code Size 458 Byte
Status AC
Exec Time 147 ms
Memory 35948 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 15
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 02_handmade_00.txt, 02_handmade_01.txt, 02_handmade_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 147 ms 35564 KiB
00_sample_01.txt AC 105 ms 35600 KiB
00_sample_02.txt AC 110 ms 35448 KiB
01_random_00.txt AC 117 ms 35804 KiB
01_random_01.txt AC 112 ms 35456 KiB
01_random_02.txt AC 110 ms 35636 KiB
01_random_03.txt AC 116 ms 35580 KiB
01_random_04.txt AC 116 ms 35644 KiB
01_random_05.txt AC 114 ms 35948 KiB
01_random_06.txt AC 114 ms 35680 KiB
01_random_07.txt AC 113 ms 35628 KiB
01_random_08.txt AC 114 ms 35560 KiB
02_handmade_00.txt AC 114 ms 35840 KiB
02_handmade_01.txt AC 119 ms 35920 KiB
02_handmade_02.txt AC 109 ms 35532 KiB