Submission #757500

# Submission time Handle Problem Language Result Execution time Memory
757500 2023-06-13T09:09:41 Z vjudge1 Lightning Conductor (POI11_pio) Java 11
Compilation error
0 ms 0 KB
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        
        int n = s.nextInt();
        ArrayList<Integer> arr = new ArrayList<Integer>();
        for (int i=0; i<n; i++){
            arr.add(s.nextInt());
        }
        for (int i=0; i<n; i++){
            System.out.println(operate(n, i, arr));
        }
        
    }
    
    public static int operate(int n, int ind, ArrayList<Integer> arr){
        int min = 0;
        int hi = arr.get(ind);
        for (int i=0; i<n; i++){
            if (n == ind){ continue; }
            int a = (int) Math.ceil(Math.sqrt(Math.abs(ind-i))) + arr.get(i) - hi;
            if (a>min){
                min = a;
            }
        }
        return min;
    }
}

Compilation message

pio.java:3: error: class Main is public, should be declared in a file named Main.java
public class Main {
       ^
1 error