Created
February 27, 2018 18:48
-
-
Save johirbuet/057385b8a3206dd3dbb9e91134952cbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class UVA12996 { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
int T = sc.nextInt(); | |
for(int t =1;t<=T;t++) { | |
int N = sc.nextInt(); | |
int L = sc.nextInt(); | |
int [] M = new int[N]; | |
int [] C = new int[N]; | |
int sum = 0; | |
for(int i =0; i< N; i++) { | |
M[i] = sc.nextInt(); | |
sum += M[i]; | |
} | |
for(int i = 0;i < N ; i++) { | |
C[i] = sc.nextInt(); | |
} | |
boolean possible = true; | |
for(int i =0; i < N; i++) { | |
if(M[i] > C[i]) { | |
possible = false; | |
break; | |
} | |
} | |
possible = possible && (sum <= L); | |
System.out.println("Case "+t+": "+(possible?"Yes":"No")); | |
} | |
sc.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment