Submission #1176093

#TimeUsernameProblemLanguageResultExecution timeMemory
1176093vibhasIntercastellar (JOI22_ho_t1)Java
Compilation error
0 ms0 KiB
import java.io.BufferedReader; import java.io.InputStreamReader; import java.sql.SQLOutput; import java.util.ArrayList; import java.util.List; public class JOI_22_Intercastellar { public static void main(String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); List<NewInteger> list = new ArrayList<>(); // this list contains what number comes how many times. for(int i = 0; i < n; i++){ int currentValue = Integer.parseInt(br.readLine()); int modified = currentValue; while(modified % 2 == 0){ // while it can still be divided modified /= 2; } list.add(new NewInteger(modified, currentValue/modified)); } int q = Integer.parseInt(br.readLine()); // queries. long currBound = list.get(0).occ; // our upper index bound long currVal = list.get(0).val; // the actual value for that index int currIndex = 1; // current index for(; q > 0; q--){ // iterate through the queries (sorted in ascending) long num = Long.parseLong(br.readLine()); while(num > currBound){ currBound += list.get(currIndex).occ; // upping it more currVal = list.get(currIndex).val; // changing the value currIndex ++; // and the index } System.out.println(currVal); } } } class NewInteger{ // class that can contain the number of occurrences and values for each new number. int occ; int val; public NewInteger(int value, int numOcc){ this.occ = numOcc; this.val = value; } }

Compilation message (stderr)

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

=======