MCPcopy Create free account
hub / github.com/Ayush7614/Daily-Coding-DS-ALGO-Practice / main

Method main

Codeforces/Java/Sleep_Cycle.java:25–55  ·  view source on GitHub ↗
(String args[])

Source from the content-addressed store, hash-verified

23
24 }
25 public static void main(String args[]) {
26 Scanner sc=new Scanner(System.in);
27 int t=sc.nextInt();
28 for(int x=1;x<=t;x++)
29 {
30
31 int n=sc.nextInt();
32 int a[]=new int[n];
33 int h=sc.nextInt();
34 String s=sc.next();
35 clusters(s,n,a);
36 int flag=0;
37 for(int x1=0;x1<n;x1++)
38 {
39 if(a[x1]!=0)
40 {
41 if(a[x1]>=h)
42 {
43 flag=1;
44 break;
45 }
46 else if (a[x1]>h/2)
47 {
48 h=2*(h-a[x1]);
49 }
50 }
51 }
52 String ans = flag == 1 ? "YES" : "NO";
53 System.out.println(ans);
54 }
55 }
56}
57
58// Input

Callers

nothing calls this directly

Calls 2

clustersMethod · 0.95
nextMethod · 0.80

Tested by

no test coverage detected