| Task: | Food |
| Sender: | michaeljackson123 |
| Submission time: | 2016-09-13 18:01:09 +0300 |
| Language: | Java |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.21 s | details |
| #2 | WRONG ANSWER | 0.21 s | details |
| #3 | WRONG ANSWER | 0.19 s | details |
| #4 | WRONG ANSWER | 0.23 s | details |
| #5 | WRONG ANSWER | 0.12 s | details |
| #6 | WRONG ANSWER | 0.20 s | details |
| #7 | WRONG ANSWER | 0.19 s | details |
| #8 | WRONG ANSWER | 0.20 s | details |
| #9 | WRONG ANSWER | 0.21 s | details |
| #10 | WRONG ANSWER | 0.20 s | details |
| #11 | WRONG ANSWER | 0.21 s | details |
| #12 | WRONG ANSWER | 0.22 s | details |
| #13 | WRONG ANSWER | 0.14 s | details |
| #14 | WRONG ANSWER | 0.21 s | details |
| #15 | WRONG ANSWER | 0.19 s | details |
| #16 | WRONG ANSWER | 0.21 s | details |
| #17 | WRONG ANSWER | 0.22 s | details |
| #18 | WRONG ANSWER | 0.14 s | details |
| #19 | WRONG ANSWER | 0.22 s | details |
| #20 | WRONG ANSWER | 0.22 s | details |
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 javaapplication7;
import java.util.PriorityQueue;
/**
*
* @author tuukkatu
*/
public class JavaApplication7 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
IO io = new IO();
//String a = io.next(); // Lukee seuraavan välein erotellun merkkijonon.
//int b = io.nextInt(); // Lukee seuraavan välein erotellun int-kokonaisluvun.
//long c = io.nextLong(); // Lukee seuraavan välein erotellun long-kokonaisluvun.
//double d = io.nextDouble(); // Lukee seuraavan välein erotellun double-liukuluvun.
long numOfCallers = io.nextInt();
long i = numOfCallers;
PriorityQueue<FoodTime> foodTimes = new PriorityQueue<FoodTime>();
while (i > 0)
{
long a = io.nextInt();
long b = io.nextInt();
foodTimes.add(new FoodTime(a,b));
i--;
}
//foodTimes.add(new FoodTime(3,2));
//foodTimes.add(new FoodTime(4,8));
//foodTimes.add(new FoodTime(1,2));
long callStart = 0;
long end = 0;
while (!foodTimes.isEmpty()) {
FoodTime thisTime = foodTimes.poll();
callStart += thisTime.callTime;
end = Math.max(end, callStart + thisTime.deliveryTime);
}
io.println(end);
io.close(); // TÄYTYY KUTSUA LOPUKSI, muuten tuloste voi jäädä kirjoittamatt
}
static class FoodTime implements Comparable<FoodTime> {
private long callTime;
private long deliveryTime;
public FoodTime(long a, long b) {
this.callTime = a;
this.deliveryTime = b;
}
public long getCallTime() {
return callTime;
}
public long getDeliveryTime() {
return deliveryTime;
}
@Override
public int compareTo(FoodTime o)
{
if (this.getDeliveryTime() > o.getDeliveryTime())
{
return -1;
}
return 0;
}
}
}
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 89384 681692778 846930887 957747794 714636916 719885387 424238336 596516650 649760493 ... |
| correct output |
|---|
| 42147058766965 |
| user output |
|---|
| 42148058684934 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 100000 359160035 411697972 968780718 734301045 453848409 688724883 164253927 734806101 ... |
| correct output |
|---|
| 47222273083201 |
| user output |
|---|
| 47223273070890 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 44480 362933728 933793117 891136996 323613975 94635258 248274880 6815710 724743065 ... |
| correct output |
|---|
| 20844945142934 |
| user output |
|---|
| 20845944958512 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 100000 793185233 288183591 37963413 618955541 431443272 198177617 496048961 69352054 ... |
| correct output |
|---|
| 47102072350982 |
| user output |
|---|
| 47103072346231 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 3155 618827474 60542179 527933441 114537664 70733156 243416943 969550074 152211461 ... |
| correct output |
|---|
| 1500343496945 |
| user output |
|---|
| 1501342367087 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 100000 910963441 143294384 713266793 860151529 993281319 41804445 373567075 274241561 ... |
| correct output |
|---|
| 46887883327574 |
| user output |
|---|
| 46888883319482 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 28162 134919079 814389249 462178596 518815506 129524528 476439372 293505853 399662455 ... |
| correct output |
|---|
| 13252390774552 |
| user output |
|---|
| 13253390634913 |
Test 8
Verdict: WRONG ANSWER
| input |
|---|
| 100000 116238406 23950922 192719099 161355170 791155851 144252659 968021758 429552179 ... |
| correct output |
|---|
| 47099509771247 |
| user output |
|---|
| 47100509689872 |
Test 9
Verdict: WRONG ANSWER
| input |
|---|
| 80676 955479656 607661572 406105372 205043535 439059576 504415953 198026879 574037487 ... |
| correct output |
|---|
| 38150726947166 |
| user output |
|---|
| 38151726924186 |
Test 10
Verdict: WRONG ANSWER
| input |
|---|
| 100000 719589006 144908765 816296155 975791631 306585999 463857005 111974616 31151282 ... |
| correct output |
|---|
| 46986601423372 |
| user output |
|---|
| 46987601406046 |
Test 11
Verdict: WRONG ANSWER
| input |
|---|
| 52870 94072776 697217561 312414108 163547056 525050122 874742904 811284897 582428307 ... |
| correct output |
|---|
| 24949625769940 |
| user output |
|---|
| 24950625660343 |
Test 12
Verdict: WRONG ANSWER
| input |
|---|
| 100000 24951805 862725068 133221224 988570326 917319027 475953991 221262630 524912601 ... |
| correct output |
|---|
| 46925181986472 |
| user output |
|---|
| 46926181961502 |
Test 13
Verdict: WRONG ANSWER
| input |
|---|
| 4111 957981573 241070686 651592347 758396414 832226666 596050875 292541224 25929816 ... |
| correct output |
|---|
| 1926884537566 |
| user output |
|---|
| 1927883172674 |
Test 14
Verdict: WRONG ANSWER
| input |
|---|
| 100000 251725245 77171349 90577136 473745863 167654421 354782932 923594762 650005823 ... |
| correct output |
|---|
| 46941247798964 |
| user output |
|---|
| 46942247786059 |
Test 15
Verdict: WRONG ANSWER
| input |
|---|
| 35135 858577961 405718020 798186777 119257724 864602943 904466622 864409840 555139510 ... |
| correct output |
|---|
| 16520298783731 |
| user output |
|---|
| 16521298510083 |
Test 16
Verdict: WRONG ANSWER
| input |
|---|
| 100000 188509002 200018574 287247908 822624098 101701451 283835672 457476331 88054113 ... |
| correct output |
|---|
| 46970995271443 |
| user output |
|---|
| 46971995257399 |
Test 17
Verdict: WRONG ANSWER
| input |
|---|
| 99800 631858331 746120730 76109035 639667425 514304658 612831726 479354598 268768336 ... |
| correct output |
|---|
| 46996558109334 |
| user output |
|---|
| 46997558075573 |
Test 18
Verdict: WRONG ANSWER
| input |
|---|
| 100000 86697323 903699564 672895479 975551966 949280629 265984694 298793170 921622295 ... |
| correct output |
|---|
| 47061738332320 |
| user output |
|---|
| 47062738267005 |
Test 19
Verdict: WRONG ANSWER
| input |
|---|
| 89912 220922738 763777725 516271940 238232413 34685422 248167527 465168443 70301610 ... |
| correct output |
|---|
| 42258460387706 |
| user output |
|---|
| 42259460380069 |
Test 20
Verdict: WRONG ANSWER
| input |
|---|
| 100000 383409812 499086892 931098608 115082744 52074979 597961407 31693436 492333918 ... |
| correct output |
|---|
| 47022483606892 |
| user output |
|---|
| 47023483587840 |
