Submission #2077318
Source Code Expand
import java.util.Arrays; import java.util.Iterator; import java.util.PrimitiveIterator; import java.util.Scanner; import java.util.stream.IntStream; import java.util.stream.Stream; class Main{ private void solve(){ int n=gInt(); int[]a=ints(n).toArray(); long r=a[0]-1; a[0]=1; int min=1; for(int i=1;i<n;++i) { if(a[i]>min+1) { r+=((a[i]-1)/(min+1)); a[i]=min; }else { min=a[i]; } } System.out.println(r); System.err.println(Arrays.toString(a)); } public static void main(String[]$){ new Main().solve(); } static Scanner s=new Scanner(System.in); static int gInt(){ return s.nextInt(); } static long gLong(){ return s.nextLong(); } static long gDouble(){ return s.nextLong(); } static Range rep(int i){ return new Range(i); } static Range rep(int f,int t,int d){ return new Range(f,t,d); } static Range rep(int f,int t){ return rep(f,t,1); } static Range rrep(int f,int t){ return rep(f,t,-1); } static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{ int to,cur,d; Range(int from,int to,int d){ this.cur=from-d; this.to=to; this.d=d; } Range(int n){ this(0,n-1,1); } @Override public Iterator<Integer> iterator(){ return this; } @Override public boolean hasNext(){ return cur+d==to||(cur!=to&&(cur<to==cur+d<to)); } @Override public int nextInt(){ return cur+=d; } } static IntStream REPS(int v){ return IntStream.range(0,v); } static IntStream REPS(int l,int r){ return IntStream.rangeClosed(l,r); } static IntStream ints(int n){ return REPS(n).map(i->gInt()); } static Stream<String> strs(int n){ return REPS(n).mapToObj(i->s.next()); } }
Submission Info
Submission Time | |
---|---|
Task | D - Greedy customers |
User | fal_rnd |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 1832 Byte |
Status | WA |
Exec Time | 621 ms |
Memory | 55228 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 30.txt, 31.txt, 32.txt, 33.txt, 34.txt, 35.txt, 36.txt, 37.txt, 38.txt, 39.txt, 40.txt, 41.txt, 42.txt, 43.txt, 44.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 597 ms | 51416 KB |
02.txt | AC | 591 ms | 53468 KB |
03.txt | AC | 601 ms | 50672 KB |
04.txt | AC | 598 ms | 51248 KB |
05.txt | WA | 536 ms | 49648 KB |
06.txt | WA | 535 ms | 48896 KB |
07.txt | WA | 544 ms | 48780 KB |
08.txt | WA | 524 ms | 50856 KB |
09.txt | WA | 508 ms | 46512 KB |
10.txt | WA | 509 ms | 50260 KB |
11.txt | WA | 509 ms | 46148 KB |
12.txt | WA | 510 ms | 49128 KB |
13.txt | WA | 571 ms | 53384 KB |
14.txt | AC | 575 ms | 55228 KB |
15.txt | AC | 556 ms | 51028 KB |
16.txt | WA | 563 ms | 53188 KB |
17.txt | WA | 621 ms | 53196 KB |
18.txt | WA | 578 ms | 53648 KB |
19.txt | WA | 573 ms | 47456 KB |
20.txt | AC | 601 ms | 52660 KB |
21.txt | AC | 564 ms | 49512 KB |
22.txt | AC | 554 ms | 51488 KB |
23.txt | AC | 566 ms | 49672 KB |
24.txt | AC | 592 ms | 47692 KB |
25.txt | AC | 550 ms | 48436 KB |
26.txt | AC | 561 ms | 49372 KB |
27.txt | AC | 565 ms | 48832 KB |
28.txt | AC | 572 ms | 50792 KB |
29.txt | AC | 507 ms | 48116 KB |
30.txt | AC | 468 ms | 50024 KB |
31.txt | AC | 554 ms | 52416 KB |
32.txt | WA | 558 ms | 50052 KB |
33.txt | WA | 533 ms | 49620 KB |
34.txt | WA | 550 ms | 47448 KB |
35.txt | WA | 543 ms | 44520 KB |
36.txt | AC | 184 ms | 26964 KB |
37.txt | AC | 170 ms | 24276 KB |
38.txt | AC | 169 ms | 24276 KB |
39.txt | AC | 179 ms | 26580 KB |
40.txt | AC | 176 ms | 28628 KB |
41.txt | AC | 173 ms | 26828 KB |
42.txt | AC | 172 ms | 24660 KB |
43.txt | AC | 184 ms | 27344 KB |
44.txt | AC | 176 ms | 26704 KB |
s1.txt | AC | 182 ms | 24660 KB |
s2.txt | AC | 173 ms | 24532 KB |