Submission #619082
Source Code Expand
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
int h = sc.nextInt();
int w = sc.nextInt();
int n = sc.nextInt();
double[] x = new double[n];
double[] y = new double[n];
double[] tan = new double[n];
double[][] z = new double[w][h];
for(int i=0;i<n;i++){
x[i] = sc.nextDouble();
y[i] = sc.nextDouble();
if(x[i] == 0){
tan[i] = 20;
} else {
tan[i] = y[i]/x[i];
}
}
Arrays.sort(tan);
if(n%2 == 1){
System.out.println(-1);
} else if(tan[n/2] == tan[n/2-1]){
System.out.println(-1);
} else {
for(int i=1;i<w+1;i++){
for(int j=1;j<h+1;j++){
z[i-1][j-1] = (double)j/i;
if(tan[n/2-1]<z[i-1][j-1] && z[i-1][j-1]<tan[n/2] && (i==5||j==5)){
System.out.println("("+i+","+j+")");
}
}
}
}
}
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - ケーキ・カッティング (Cake Cutting) |
| User | Namazu_titech |
| Language | Java (OpenJDK 1.7.0) |
| Score | 0 |
| Code Size | 922 Byte |
| Status | WA |
| Exec Time | 461 ms |
| Memory | 25364 KiB |
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 100 | ||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample1.txt, sample2.txt, sample3.txt |
| All | in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| in1.txt | AC | 461 ms | 24956 KiB |
| in2.txt | WA | 407 ms | 25036 KiB |
| in3.txt | WA | 423 ms | 25092 KiB |
| in4.txt | AC | 409 ms | 25364 KiB |
| in5.txt | AC | 409 ms | 24916 KiB |
| in6.txt | WA | 418 ms | 25244 KiB |
| in7.txt | WA | 407 ms | 25244 KiB |
| in8.txt | AC | 412 ms | 25164 KiB |
| sample1.txt | AC | 409 ms | 25196 KiB |
| sample2.txt | AC | 402 ms | 25184 KiB |
| sample3.txt | WA | 404 ms | 25140 KiB |