Submission details
Task:Food
Sender:michaeljackson123
Submission time:2016-09-13 19:02:42 +0300
Language:Java
Status:COMPILE ERROR

Compiler report

input/JavaApplication7.java:24: error: cannot find symbol
        IO io = new IO();
        ^
  symbol:   class IO
  location: class JavaApplication7
input/JavaApplication7.java:24: error: cannot find symbol
        IO io = new IO();
                    ^
  symbol:   class IO
  location: class JavaApplication7
2 errors

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;
import java.util.Scanner;

/**
 *
 * @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();
        
        Scanner scan = new Scanner(System.in);
        
	//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 numOfCallers = Long.parseLong(scan.nextLine());
        
        long i = numOfCallers;
        
        PriorityQueue<FoodTime> foodTimes = new PriorityQueue<FoodTime>();
        
        while (i > 0)
        {
            long a = io.nextLong();
            long b = io.nextLong();
            
            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();
            
            //io.println(thisTime.callTime + " " + thisTime.deliveryTime);
            
            callStart += thisTime.callTime;
            long endOfThis = callStart + thisTime.deliveryTime;
            if (endOfThis > end) {
                end = endOfThis;
            }
            //io.println(end);
        }
        
	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;
            }
            else if (this.getDeliveryTime() == o.getDeliveryTime()) {
                return 0;
            }
            else {
                return 1;
            }
        }
        
        
}

    
}