Submission #643832
Source Code Expand
import java.util.*; public class Main { Scanner cin = new Scanner(System.in); public void solve() { int N = cin.nextInt(); int[] c = new int[N]; int[] dp = new int[N + 1]; for(int i = 0;i < N + 1;i++) dp[i] = Integer.MAX_VALUE; for(int i = 0;i < N;i++) { c[i] = cin.nextInt(); } int ans = 0; for(int i = 0;i < N;i++) { int index = Arrays.binarySearch(dp,c[i]); if(index < 0)index = -(index + 1); dp[index] = c[i]; } for(int i = 0;i < N;i++) { if(dp[i] == Integer.MAX_VALUE)continue; ans++; } System.out.println(N - ans); } public static void main(String[] args) { new Main().solve(); } }
Submission Info
Submission Time | |
---|---|
Task | D - トランプ挿入ソート |
User | tookunn |
Language | Java (OpenJDK 1.7.0) |
Score | 100 |
Code Size | 680 Byte |
Status | AC |
Exec Time | 737 ms |
Memory | 37272 KB |
Judge Result
Set Name | smallA | smallB | all | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 10 / 10 | 40 / 40 | 50 / 50 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
smallA | test_01_ABC.txt, test_04_ABC.txt, test_07_ABC.txt, test_10_ABC.txt, test_13_ABC.txt, test_16_ABC.txt, test_19_ABC.txt, test_22_ABC.txt, test_25_ABC.txt, test_28_ABC.txt, test_31_ABC.txt, test_32_ABC.txt, test_35_ABC.txt, test_38_ABC.txt, test_41_ABC.txt, test_44_ABC.txt, test_47_ABC.txt, test_50_ABC.txt, test_53_ABC.txt |
smallB | test_01_ABC.txt, test_02_AB.txt, test_04_ABC.txt, test_05_AB.txt, test_07_ABC.txt, test_08_AB.txt, test_10_ABC.txt, test_11_AB.txt, test_13_ABC.txt, test_14_AB.txt, test_16_ABC.txt, test_17_AB.txt, test_19_ABC.txt, test_20_AB.txt, test_22_ABC.txt, test_23_AB.txt, test_25_ABC.txt, test_26_AB.txt, test_28_ABC.txt, test_29_AB.txt, test_31_ABC.txt, test_32_ABC.txt, test_33_AB.txt, test_35_ABC.txt, test_36_AB.txt, test_38_ABC.txt, test_39_AB.txt, test_41_ABC.txt, test_42_AB.txt, test_44_ABC.txt, test_45_AB.txt, test_47_ABC.txt, test_48_AB.txt, test_50_ABC.txt, test_51_AB.txt, test_53_ABC.txt, test_54_AB.txt |
all | test_01_ABC.txt, test_02_AB.txt, test_03_A.txt, test_04_ABC.txt, test_05_AB.txt, test_06_A.txt, test_07_ABC.txt, test_08_AB.txt, test_09_A.txt, test_10_ABC.txt, test_11_AB.txt, test_12_A.txt, test_13_ABC.txt, test_14_AB.txt, test_15_A.txt, test_16_ABC.txt, test_17_AB.txt, test_18_A.txt, test_19_ABC.txt, test_20_AB.txt, test_21_A.txt, test_22_ABC.txt, test_23_AB.txt, test_24_A.txt, test_25_ABC.txt, test_26_AB.txt, test_27_A.txt, test_28_ABC.txt, test_29_AB.txt, test_30_A.txt, test_31_ABC.txt, test_32_ABC.txt, test_33_AB.txt, test_34_A.txt, test_35_ABC.txt, test_36_AB.txt, test_37_A.txt, test_38_ABC.txt, test_39_AB.txt, test_40_A.txt, test_41_ABC.txt, test_42_AB.txt, test_43_A.txt, test_44_ABC.txt, test_45_AB.txt, test_46_A.txt, test_47_ABC.txt, test_48_AB.txt, test_49_A.txt, test_50_ABC.txt, test_51_AB.txt, test_52_A.txt, test_53_ABC.txt, test_54_AB.txt, test_55_A.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample_01.txt | AC | 360 ms | 23348 KB |
sample_02.txt | AC | 363 ms | 23244 KB |
sample_03.txt | AC | 360 ms | 23288 KB |
test_01_ABC.txt | AC | 359 ms | 23268 KB |
test_02_AB.txt | AC | 423 ms | 24628 KB |
test_03_A.txt | AC | 712 ms | 36996 KB |
test_04_ABC.txt | AC | 355 ms | 23260 KB |
test_05_AB.txt | AC | 412 ms | 24368 KB |
test_06_A.txt | AC | 500 ms | 27396 KB |
test_07_ABC.txt | AC | 355 ms | 23232 KB |
test_08_AB.txt | AC | 471 ms | 24492 KB |
test_09_A.txt | AC | 708 ms | 36856 KB |
test_10_ABC.txt | AC | 355 ms | 23244 KB |
test_11_AB.txt | AC | 388 ms | 24024 KB |
test_12_A.txt | AC | 683 ms | 36840 KB |
test_13_ABC.txt | AC | 359 ms | 23324 KB |
test_14_AB.txt | AC | 458 ms | 24632 KB |
test_15_A.txt | AC | 737 ms | 37120 KB |
test_16_ABC.txt | AC | 389 ms | 23216 KB |
test_17_AB.txt | AC | 415 ms | 24244 KB |
test_18_A.txt | AC | 492 ms | 25808 KB |
test_19_ABC.txt | AC | 349 ms | 23284 KB |
test_20_AB.txt | AC | 429 ms | 24692 KB |
test_21_A.txt | AC | 716 ms | 37136 KB |
test_22_ABC.txt | AC | 350 ms | 23252 KB |
test_23_AB.txt | AC | 404 ms | 24364 KB |
test_24_A.txt | AC | 691 ms | 37188 KB |
test_25_ABC.txt | AC | 363 ms | 23308 KB |
test_26_AB.txt | AC | 433 ms | 24576 KB |
test_27_A.txt | AC | 706 ms | 37120 KB |
test_28_ABC.txt | AC | 355 ms | 23300 KB |
test_29_AB.txt | AC | 439 ms | 24508 KB |
test_30_A.txt | AC | 712 ms | 37272 KB |
test_31_ABC.txt | AC | 351 ms | 23284 KB |
test_32_ABC.txt | AC | 355 ms | 23228 KB |
test_33_AB.txt | AC | 443 ms | 24660 KB |
test_34_A.txt | AC | 708 ms | 36932 KB |
test_35_ABC.txt | AC | 352 ms | 23296 KB |
test_36_AB.txt | AC | 398 ms | 24252 KB |
test_37_A.txt | AC | 553 ms | 29312 KB |
test_38_ABC.txt | AC | 350 ms | 23252 KB |
test_39_AB.txt | AC | 418 ms | 24592 KB |
test_40_A.txt | AC | 715 ms | 37256 KB |
test_41_ABC.txt | AC | 350 ms | 23260 KB |
test_42_AB.txt | AC | 404 ms | 24168 KB |
test_43_A.txt | AC | 519 ms | 28504 KB |
test_44_ABC.txt | AC | 358 ms | 23320 KB |
test_45_AB.txt | AC | 422 ms | 24496 KB |
test_46_A.txt | AC | 705 ms | 36884 KB |
test_47_ABC.txt | AC | 353 ms | 23244 KB |
test_48_AB.txt | AC | 370 ms | 23904 KB |
test_49_A.txt | AC | 517 ms | 28148 KB |
test_50_ABC.txt | AC | 355 ms | 23392 KB |
test_51_AB.txt | AC | 430 ms | 24592 KB |
test_52_A.txt | AC | 711 ms | 36940 KB |
test_53_ABC.txt | AC | 352 ms | 23264 KB |
test_54_AB.txt | AC | 375 ms | 23836 KB |
test_55_A.txt | AC | 707 ms | 37020 KB |