Submission details
Task:Platformer
Sender:Anonyymit Algoritmistit
Submission time:2015-09-16 19:34:18 +0300
Language:Java
Status:READY
Result:
Test results
testverdicttime
#10.22 sdetails
#20.22 sdetails
#30.24 sdetails
#40.23 sdetails
#50.24 sdetails
#60.23 sdetails
#70.23 sdetails
#80.23 sdetails
#90.21 sdetails
#100.22 sdetails
#110.23 sdetails
#120.22 sdetails
#130.21 sdetails
#140.22 sdetails
#150.22 sdetails
#160.21 sdetails
#170.21 sdetails
#180.23 sdetails
#190.21 sdetails
#200.23 sdetails
#210.22 sdetails
#220.22 sdetails
#230.23 sdetails
#240.22 sdetails
#250.23 sdetails
#260.21 sdetails
#270.22 sdetails
#280.21 sdetails
#290.23 sdetails
#300.22 sdetails
#310.17 sdetails
#320.23 sdetails
#330.23 sdetails
#340.23 sdetails
#350.22 sdetails
#360.21 sdetails
#370.22 sdetails
#380.22 sdetails
#390.26 sdetails
#400.21 sdetails
#410.23 sdetails
#420.23 sdetails
#430.24 sdetails
#440.22 sdetails
#450.22 sdetails
#460.25 sdetails
#470.22 sdetails
#480.21 sdetails
#490.22 sdetails
#500.21 sdetails
#510.23 sdetails

Code

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
//package kilo.v2.t3;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 *
 * @author asjuvone
 */
public class KILOV2T3 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        IO io = new IO();
        int n = io.nextInt();
        int q = io.nextInt();
        int w = io.nextInt();
        int k = io.nextInt();
        int[] juomat = new int[n+1];
        int[] juomienArvot = new int[n+1];
        for (int i=1; i<=n; i++) {
            if (io.nextInt() == 0) juomat[i] = -1;
            else {
                juomat[i] = io.nextInt(); // x-koordinaatti juomalle tasolla i
                juomienArvot[i] = io.nextInt();
            }
        }
        
        TreeMap<Long, TreeSet<Long>> paikat = new TreeMap<>();
        TreeSet<Long> lista = new TreeSet<>();
        lista.add((long)q);
        paikat.put((long)w, lista);
        for (int kerros=1; kerros<n; kerros++) {
            Iterator<Long> it = paikat.descendingKeySet().iterator();
            long kuolemaRaja = (kerros-1) * k;
            long parasReittiJuomalle = kuolemaRaja+1;
            while (it.hasNext()) {
                long v = it.next();
                if (v <= kuolemaRaja) break;
                
                Long x = (long) paikat.get(v).floor((long)juomat[kerros]);
                if (x != null) {
                    long vahennys = Math.abs(juomat[kerros] - x);
                    long lisays = juomienArvot[kerros];
                    long nykReittiJuomalle = v - vahennys + lisays;
                    if (nykReittiJuomalle > parasReittiJuomalle) {
                        parasReittiJuomalle = nykReittiJuomalle;
                        kuolemaRaja = parasReittiJuomalle;
                    }
                }
                x = paikat.get(v).ceiling((long)juomat[kerros]);
                if (x != null) {
                    long vahennys = Math.abs(juomat[kerros] - x);
                    long lisays = juomienArvot[kerros];
                    long nykReittiJuomalle = v - vahennys + lisays;
                    if (nykReittiJuomalle > parasReittiJuomalle) {
                        parasReittiJuomalle = nykReittiJuomalle;
                        kuolemaRaja = parasReittiJuomalle;
                    }
                }
            }
            TreeSet<Long> uusLista = paikat.get(parasReittiJuomalle);
            if (uusLista == null) {
                uusLista = new TreeSet<Long>();
                paikat.put(parasReittiJuomalle, uusLista);
            }
            uusLista.add((long)juomat[kerros]);
        }
        if (paikat.lastKey() >= (k*(n-1))) System.out.println("10-4");
        else System.out.println("QAQ");
    }
    
}

Test details

Test 1

Verdict:

input
93720 39133 271745 8828
0
1 35503 41358
0
0
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 2

Verdict:

input
97192 56015 123131 3873
1 83352 32477
1 94775 7864
0
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 3

Verdict:

input
99108 94600 113316 4855
0
0
0
0
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 4

Verdict:

input
94908 98153 200335 9390
0
1 97222 4762
1 92494 69700
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 5

Verdict:

input
97925 19788 254413 9008
1 50423 68974
0
0
1 90601 12470
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 6

Verdict:

input
90769 94368 226055 9254
1 6188 38889
0
0
1 15760 61611
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 7

Verdict:

input
93010 53265 141409 6629
1 69399 59938
0
0
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 8

Verdict:

input
94604 86622 3197 291
1 33740 246144103
1 14472 413062285
1 21305 728358221
1 97273 666356704
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 9

Verdict:

input
90370 12656 203687 7741
0
1 20615 4965
0
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 10

Verdict:

input
92711 1731 84200 9537
1 22362 44030
0
1 73954 148394
1 58582 92246
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 11

Verdict:

input
97776 25155 104115 3949
1 68851 39872
1 23281 27180
0
0
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 12

Verdict:

input
94285 13824 213256 6473
1 19089 7129
1 91649 15534
0
1 84631 18708
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 13

Verdict:

input
97129 78853 3211 934
1 83665 499047841
0
0
0
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 14

Verdict:

input
97992 37208 81257 9418
0
0
1 16726 18007
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 15

Verdict:

input
91420 4824 115989 9403
0
1 77876 68096
1 42186 46525
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 16

Verdict:

input
96179 90979 49680 2890
0
0
0
1 62847 45363
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 17

Verdict:

input
95647 17291 19818 1740
1 61265 234051494
0
0
1 9322 35801
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 18

Verdict:

input
98835 73849 160991 5151
1 3346 15560
1 42345 51204
0
1 71893 3785
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 19

Verdict:

input
91256 48792 152543 5308
1 99803 46272
0
1 65300 39202
1 83359 39980
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 20

Verdict:

input
98178 44514 183313 7966
0
0
0
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 21

Verdict:

input
90142 20281 154074 8583
0
0
0
1 65682 10123
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 22

Verdict:

input
99508 50312 28005 1483
1 8698 561100463
1 27518 17753
1 35183 6874
1 51423 709
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 23

Verdict:

input
93572 52286 10683 5994
0
1 44635 143939594
1 98077 274789312
1 29936 101782377
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 24

Verdict:

input
99507 16701 226527 9776
1 6848 34903
0
1 84638 50801
1 91779 82623
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 25

Verdict:

input
93687 91600 174 117
0
1 72495 527049261
0
1 61437 169018252
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 26

Verdict:

input
92181 11937 165368 5326
1 93556 16607
1 63375 639
0
1 34722 2656
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 27

Verdict:

input
99053 16063 75605 6270
0
0
1 25114 124515
1 7349 30745
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 28

Verdict:

input
91912 80570 12959 635
0
1 58320 237459984
1 47571 169756497
1 34391 329136180
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 29

Verdict:

input
97096 15695 104773 5067
0
1 57538 26420
1 17419 65054
1 55286 49658
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 30

Verdict:

input
94271 93605 53716 7282
0
0
0
1 63342 63872
...

correct output
QAQ

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 31

Verdict:

input
10 48792 152543 5308
0
0
0
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 32

Verdict:

input
97186 68207 36491 1
1 62847 1015
1 10662 424705944
1 63603 31508
1 93933 31123
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 33

Verdict:

input
98824 51796 60765 1
1 57459 6393
1 81114 11603
0
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 34

Verdict:

input
99707 79141 24396 1
1 15305 787266981
1 40625 325204064
1 71642 27545
1 11143 519121854
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 35

Verdict:

input
99499 66563 10726 1
0
1 50930 4917259
1 89683 362392181
1 56945 6604
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 36

Verdict:

input
96474 74211 32506 2
1 23133 265260726
0
1 55091 111891
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 37

Verdict:

input
98892 62723 24829 1
1 91722 519273406
1 37709 465156425
1 94342 847977954
1 58182 9236
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 38

Verdict:

input
95020 50407 58686 2
1 98541 88094
1 99994 29336
0
1 68064 24948
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 39

Verdict:

input
99678 16584 44706 1
1 9935 1157
1 61471 809296994
1 25220 24675
1 43197 21080
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 40

Verdict:

input
97562 3891 116896 2
1 5550 10290
1 3235 2632
1 92484 60120
1 42302 23320
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 41

Verdict:

input
95382 38603 53680 2
0
1 73212 43790
1 9191 11570
1 15853 77057
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 42

Verdict:

input
98321 68338 7247 1
0
1 70810 476
1 12697 537286430
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 43

Verdict:

input
96622 16601 3959 1
1 31931 888513681
1 90381 431318803
1 9327 433232402
1 97464 149691554
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 44

Verdict:

input
98097 3823 31380 1
1 49745 170502842
1 24743 4541
1 37009 145
1 1903 776
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 45

Verdict:

input
96353 99694 19331 2
1 6141 280627823
1 5938 685091507
0
1 75645 36271308
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 46

Verdict:

input
96566 6661 63261 1
1 52321 3509
1 28252 1429
0
1 36092 1839
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 47

Verdict:

input
97998 25315 9841 2
0
1 81801 398177857
0
1 60076 10826582
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 48

Verdict:

input
98709 93527 29589 1
0
1 40439 472607569
1 24151 449756851
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 49

Verdict:

input
98681 12780 1379 1
0
0
1 52013 938639644
1 5933 109004048
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 50

Verdict:

input
96889 34349 15648 1
1 41768 2294
1 85676 615774769
1 97093 519801205
0
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)

Test 51

Verdict:

input
95849 18797 40401 1
1 7503 649
0
0
1 56595 347
...

correct output
10-4

user output
(empty)

Error:
Exception in thread "main" java.lang.NullPointerException
	at KILOV2T3.main(KILOV2T3.java:52)