Submission #563235

# Submission time Handle Problem Language Result Execution time Memory
563235 2022-05-16T14:37:28 Z jh05013 Lonely mdic (kriii1_L) Java 11
0 / 1
2000 ms 24064 KB
import java.awt.geom.*;
import java.util.*;
import java.io.*;
 
public class L {
 
public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    StringBuilder sb = new StringBuilder();
 
    int n = sc.nextInt();
    ArrayList<Area> circs = new ArrayList();
    ArrayList<Area> prec = new ArrayList();
    ArrayList<Area> sufc = new ArrayList();
    for(int i = 0; i < n; i++){
        double x = sc.nextDouble();
        double y = sc.nextDouble();
        double r = sc.nextDouble();
        Ellipse2D.Double c = new Ellipse2D.Double(x-r, y-r, 2*r, 2*r);
        Area car = new Area(c);
        circs.add(car);
        prec.add((Area) car.clone());
        sufc.add((Area) car.clone());
    }
    for(int i = 1; i < n; i++) prec.get(i).add(prec.get(i-1));
    for(int i = n-2; i >= 0; i--) sufc.get(i).add(sufc.get(i+1));
 
    int ans = 0;
    for(int i = 0; i < n; i++){
        Area a = (Area) circs.get(i).clone();
        if(i != 0) a.subtract(prec.get(i-1));
        if(i != n-1) a.subtract(sufc.get(i+1));
        if(a.isEmpty()) ans++;
    }
    sb.append(ans);
 
    System.out.println(sb);
}
 
}

Compilation message

Note: L.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
# Verdict Execution time Memory Grader output
1 Correct 1340 ms 23696 KB Output is correct
2 Execution timed out 2029 ms 24064 KB Time limit exceeded
3 Halted 0 ms 0 KB -