Submission #73093920
Source Code Expand
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner k = new Scanner(System.in);
int N = k.nextInt();
String []val = new String[N];
Map<Integer,Long> map = new HashMap<>();
int max = 0;
for(int i=0;i<N;i++){
int n = k.nextInt();
max = Math.max(max,n);
map.put(n,map.getOrDefault(n,0L)+1);
}
long []dig = new long[max+1];
for(int i = max;i>=1;i--){
if(map.containsKey(i))dig[i] = map.get(i);
if(i<max){
dig[i]+=dig[i+1];
}
}
StringBuilder sb = new StringBuilder();
long carry = 0;
for(int i=1;i<=max;i++){
sb.append((dig[i]+carry)%10);
carry = (dig[i]+carry)/10;
}
while(carry>0){
sb.append(carry%10);
carry/=10;
}
System.out.print(sb.reverse());
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Many Repunit Sum |
| User | Madhavan13 |
| Language | Java24 (OpenJDK 24.0.2) |
| Score | 400 |
| Code Size | 1003 Byte |
| Status | AC |
| Exec Time | 581 ms |
| Memory | 77712 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 0_sample_1.txt, 0_sample_2.txt, 0_sample_3.txt |
| All | 0_sample_1.txt, 0_sample_2.txt, 0_sample_3.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, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 2_1.txt, 2_2.txt, 2_3.txt, 2_4.txt, 2_5.txt, 2_6.txt, 2_7.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 0_sample_1.txt | AC | 78 ms | 40252 KiB |
| 0_sample_2.txt | AC | 74 ms | 40156 KiB |
| 0_sample_3.txt | AC | 73 ms | 40572 KiB |
| 1_01.txt | AC | 541 ms | 77172 KiB |
| 1_02.txt | AC | 552 ms | 77060 KiB |
| 1_03.txt | AC | 535 ms | 76940 KiB |
| 1_04.txt | AC | 534 ms | 77136 KiB |
| 1_05.txt | AC | 528 ms | 77712 KiB |
| 1_06.txt | AC | 581 ms | 77124 KiB |
| 1_07.txt | AC | 549 ms | 77276 KiB |
| 1_08.txt | AC | 555 ms | 77028 KiB |
| 1_09.txt | AC | 538 ms | 77284 KiB |
| 1_10.txt | AC | 547 ms | 77300 KiB |
| 1_11.txt | AC | 533 ms | 77272 KiB |
| 1_12.txt | AC | 549 ms | 77168 KiB |
| 1_13.txt | AC | 545 ms | 77152 KiB |
| 1_14.txt | AC | 537 ms | 77632 KiB |
| 1_15.txt | AC | 541 ms | 77524 KiB |
| 1_16.txt | AC | 558 ms | 77528 KiB |
| 1_17.txt | AC | 541 ms | 77192 KiB |
| 1_18.txt | AC | 533 ms | 77200 KiB |
| 1_19.txt | AC | 544 ms | 77628 KiB |
| 1_20.txt | AC | 531 ms | 76252 KiB |
| 2_1.txt | AC | 371 ms | 63168 KiB |
| 2_2.txt | AC | 381 ms | 63116 KiB |
| 2_3.txt | AC | 431 ms | 66996 KiB |
| 2_4.txt | AC | 402 ms | 66244 KiB |
| 2_5.txt | AC | 75 ms | 40560 KiB |
| 2_6.txt | AC | 127 ms | 46084 KiB |
| 2_7.txt | AC | 111 ms | 43864 KiB |