### E. Lagged Speed

Author: Alham Fikri Aji
Prepared By: Alham Fikri Aji, Suhendry Effendy

I don’t like this problem. I didn’t mean it’s not a good problem, but I hate it because this problem made me stress π

You can solve this problem in two ways: by observing the values, or by finding the pattern. I solved this problem using the former method. With the help of drawing tool (I used gnuplot), I observed that there are two line shapes made by the speed changes (S), i.e. (1) increasing head, and (2) bouncing and converging tail. From there, I “only” need to derived the formula for those two shapes. However, this “only” task took me 1 hour. Another approach is by finding the pattern. As I don’t like this approach, I didn’t use it. But some contestants said that this appraoch is much easier. I also noticed that most of the accepted submissions used this approach – one line formula.

There are 156 submissions have been made for this problem, in which 12 teams managed to get accepted. The first team who solve this problem is GantengGantengKoder (minute 164) from Institut Teknologi Bandung.

### 27 Responses to “ACM-ICPC INC 2014”

1. “One popular approach was by first sorting all the strings and pair each succesive string whenever possible”, kode saya spt itu, hanya saja pasangkan dr yg terpanjang http://ideone.com/PGjPAq

2. komen untuk prob J

βOne popular approach was by first sorting all the strings and pair each succesive string whenever possibleβ, kode saya spt itu, hanya saja pasangkan dr yg terpanjang http://ideone.com/PGjPAq

• koreksi, prob G

• Ngga, kode kamu nggak seperti itu. Approach kamu itu jadi sama dengan approach greedy yang bener (pasangin dari leaves) — string yang paling panjang saat itu pasti leaf.

Yang dimaksud “pair each succesive string whenever possible” itu comparenya bener-bener cuma sama 1 string di sebelahnya aja (sorted); sedangkan kamu compare dengan yang panjangnya lebih pendek.

3. a bit curious about problem H. Did you use the real Kawal Pemilu data for judge’s test case? π

• According to the author: YES π

• Nice π

4. nice problem, nice editorial, pretty helpful, thx π

5. saya penasaran dgn problem yg blm sempat saya kerjakan (dan AC), apakah mungkin akan diupload ke situs online judge ?

saya dpt ide sederhana utk problem J dgn menelusuri apakah suatu nilai bisa jadi pivot (menjadi ‘L’), setelah itu cek apakah bs dr index tersebut menjadi good segment, jika tidak cetak impossible, kode saya : [[REMOVED]]

thx koreksinya π

• Lho, cara handle mod-nya (line 30, 41 – 43) jelas salah donk? Kenapa cuma consider pivot L yang ga punya pair-mod nya di dalam array input? Yang diminta kan pivot L yang segmentnya ga ada pair-mod nya.

contoh:
6 10
5 2 8 1 9 5

• karena “((SL + Si) mod M) ? 0, for all i where L ? i ? R.”

apakah mksdnya nilai di index L, jika dipasangkan dgn semua nilai dari L sampai R, modnya tdk akan 0 ?

utk input spt itu outputnya impossible bkn ?

• oh, bayangan sy sblmnya, segment L-R, jumlah bilangan yg berbeda harus sama dgn jml bilangan berbeda array 1 – N

• kelihatannya di situ kesalahannya, gara2 asumsi jml bil beda hrs sama dgn array input…

pertama baca merasa ada kemiripan dgn soal spoj DQUERY yg blm sy mengerti jg π

• Ho iya, “value” di soal J ini sama dengan nilai si d-query (number of distinct elements in a segment).

• “for all i where L <= i <= R" -- artinya cuma dipair dengan semua [L, R], bukan [1, N]; [L, R] itu segmentnya.

• permisi, mengganggu lagi :D, saya sdh mencoba membuat NOMOD utk range tertentu

semoga sudah benar :), [[REMOVED]]

hanya saja kompleksitasnya NOMOD tdk O(N) karena menggunakan map, kalau ada unsorted map spt c++ 11, mgkn bs π

membaca tutorial kadang jd pengen kerjain lg, apakah bs diupload soalnya ke OJ ?

• aduh msh ada salah ><, setelah di-fix, smg uda bener [[REMOVED]]

• Oit, maap beberapa hari ini lagi away, baru bisa cek messagenya.

Solusi yang pertama (SbojVj) masih salah, tapi solusi yang kedua (5i1Mvi) AC π

Anyway, soal sedang diupload ke JOJ, sebentar lagi selesai.

• terima kasih banyak π

• Soal INC sudah diupload ke JOJ. Kode soal: INC14A … INC14J

http://jollybee.binus.ac.id/oj/site/problemset/problem/code/INC14A/

• ok pak, terima kasih, di grup fb ada yg minta sekalian saya post ya link-nya π

• oh ya, apa komen saya yg menyertakan kode yg hampir AC dan AC bs diedit link-nya, takutnya dicopas buat JOJ (kalau boleh copas buat JOJ ya tidak diedit tidak apa2)

saya wkt nulis di ideone tdk login waktu itu, jd tdk bs edit kode di ideone

• Sip, udah diremoved semua link ke code nya π

6. How about ACM-ICPC 2014 Jakarta write up?? Will it be published?

• Yes, it will.

I “lost” one week due to other events after ICPC (and I’ve just come back to my home). So, expect a few more days delay π

7. How can I get input data ?

Thank you for sharing.

• Ah… I didn’t notice this comment before >.< I'll not share the input data publicly. You can test your solution in some online-judges, e.g., tokilearning or joj. (I think) I have sent the test data to the admin on those sites.