Submission #2517504
Source Code Expand
import java.util.*; class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); int array[] = new int[num]; ArrayList<Integer> table = new ArrayList<Integer>(); int n = 0; int sum = 1; int ans = 0; boolean flag = false; for ( int i = 0; i < num; i++ ) { array[i] = scan.nextInt(); } for ( int k = 0; k < num; k++ ) { for ( int a = 0; a < n; a++ ) { if ( array[k] == table.get(a) ) { // System.out.println("out"); flag = true; } } if ( flag == true ) { flag = false; break; } for ( int j = k + 1; j < num; j++ ) { if ( array[k] == array[j] ) { sum++; } } if ( array[k] <= sum ) { ans += sum - array[k]; } else { ans += sum; } table.add(new Integer(array[k])); n++; sum = 1; } System.out.println(ans); } }
Submission Info
Submission Time | |
---|---|
Task | C - Good Sequence |
User | shivashin495 |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1014 Byte |
Status | WA |
Exec Time | 2109 ms |
Memory | 50392 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 93 ms | 19156 KB |
0_01.txt | AC | 91 ms | 21844 KB |
0_02.txt | AC | 93 ms | 21588 KB |
0_03.txt | AC | 91 ms | 19028 KB |
0_04.txt | AC | 92 ms | 19412 KB |
1_00.txt | AC | 92 ms | 21204 KB |
1_01.txt | AC | 91 ms | 20564 KB |
1_02.txt | AC | 381 ms | 46424 KB |
1_03.txt | AC | 408 ms | 47628 KB |
1_04.txt | AC | 409 ms | 46328 KB |
1_05.txt | AC | 410 ms | 50392 KB |
1_06.txt | AC | 434 ms | 46004 KB |
1_07.txt | WA | 397 ms | 49156 KB |
1_08.txt | WA | 431 ms | 44048 KB |
1_09.txt | WA | 439 ms | 46336 KB |
1_10.txt | WA | 449 ms | 47128 KB |
1_11.txt | WA | 425 ms | 47964 KB |
1_12.txt | TLE | 2109 ms | 47868 KB |