Submission #241913


Source Code Expand

Copy
import java.util.Scanner;

public class Main {

	static int a, b, n;
	static int[] c, d;

	static boolean canBoxTate(int i) {
		if (c[i] >= a && d[i] >= b) {
			return true;
		}
		return false;
	}
	
	static boolean canBoxYoko(int i) {
		if (c[i] >= b && d[i] >= a) {
			return true;
		}
		return false;
	}
	
	static boolean canBoxNaname(int i) {
		double x = Math.sqrt(a * a / 2.0);
		double y = Math.sqrt(b * b / 2.0);

		//System.out.println(x);
		//System.out.println(y);
		
		if (x + y <= Math.min(c[i], d[i])) {
			return true;
		}
		
		return false;
	}
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		a = scan.nextInt();
		b = scan.nextInt();
		n = scan.nextInt();
		c = new int[n];
		d = new int[n];

		for (int i = 0; i < n; i++) {
			c[i] = scan.nextInt();
			d[i] = scan.nextInt();
		}

		for (int i = 0; i < n; i++) {
			if (canBoxTate(i)) {
				System.out.println("YES");
				continue;
			}
			
			if (canBoxYoko(i)) {
				System.out.println("YES");
				continue;
			}
			
			if (canBoxNaname(i)) {
				System.out.println("YES");
				continue;
			}
			System.out.println("NO");
		}
		
		
		scan.close();
	}

}

Submission Info

Submission Time
Task B - 高橋君と禁断の書
User uriku
Language Java (OpenJDK 1.7.0)
Score 0
Code Size 1234 Byte
Status
Exec Time 888 ms
Memory 36284 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0-sample-01.txt
All 0 / 100 subtask0-sample-01.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt, subtask1-16.txt, subtask1-17.txt, subtask1-18.txt, subtask1-19.txt, subtask1-20.txt, subtask1-21.txt, subtask1-22.txt, subtask1-23.txt, subtask1-24.txt, subtask1-25.txt, subtask1-26.txt, subtask1-27.txt, subtask1-28.txt, subtask1-29.txt, subtask1-30.txt
Case Name Status Exec Time Memory
subtask0-sample-01.txt 427 ms 23220 KB
subtask1-01.txt 427 ms 23216 KB
subtask1-02.txt 509 ms 24832 KB
subtask1-03.txt 653 ms 28644 KB
subtask1-04.txt 716 ms 30488 KB
subtask1-05.txt 728 ms 30388 KB
subtask1-06.txt 759 ms 32412 KB
subtask1-07.txt 756 ms 32548 KB
subtask1-08.txt 772 ms 32820 KB
subtask1-09.txt 756 ms 32760 KB
subtask1-10.txt 855 ms 36076 KB
subtask1-11.txt 865 ms 35432 KB
subtask1-12.txt 862 ms 36104 KB
subtask1-13.txt 867 ms 36000 KB
subtask1-14.txt 888 ms 35344 KB
subtask1-15.txt 847 ms 35372 KB
subtask1-16.txt 853 ms 36064 KB
subtask1-17.txt 865 ms 36132 KB
subtask1-18.txt 857 ms 35636 KB
subtask1-19.txt 873 ms 35612 KB
subtask1-20.txt 844 ms 35960 KB
subtask1-21.txt 871 ms 36072 KB
subtask1-22.txt 868 ms 35492 KB
subtask1-23.txt 874 ms 36068 KB
subtask1-24.txt 866 ms 35448 KB
subtask1-25.txt 873 ms 36284 KB
subtask1-26.txt 865 ms 36184 KB
subtask1-27.txt 861 ms 35224 KB
subtask1-28.txt 876 ms 36204 KB
subtask1-29.txt 861 ms 36036 KB
subtask1-30.txt 860 ms 35716 KB