Submission #370888

#TimeUsernameProblemLanguageResultExecution timeMemory
370888R3KTHacker (BOI15_hac)Java
Compilation error
0 ms0 KiB
import java.util.*; import java.io.*; public class HAC { // https://oj.uz/problem/view/BOI15_hac public static void main(String[] args) throws IOException, FileNotFoundException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); //BufferedReader in = new BufferedReader(new FileReader("HAC")); int n = Integer.parseInt(in.readLine()); long[] arr = new long[n]; StringTokenizer st = new StringTokenizer(in.readLine()); for (int i=0; i<n; i++) { arr[i] = Integer.parseInt(st.nextToken()); } ArrayList<Long> sums = new ArrayList<Long>(); long sum=0; int k = (n+1)/2; for (int i=0; i<k; i++) { sum += arr[i]; } sums.add(sum); for (int i=0; i<n-1; i++) { sum -= arr[i]; sum += (arr[(i+k)%n]); sums.add(sum); } long ans=Math.min(sums.get(sums.size()-1), sums.get(0)); for (int i=0; i<sums.size()-1; i++) { ans = Math.max(ans, Math.min(sums.get(i), sums.get(i+1))); } System.out.println(ans); } }

Compilation message (stderr)

hac.java:5: error: class HAC is public, should be declared in a file named HAC.java
public class HAC {
       ^
1 error