solution for D
sort cs array
get divisors of x1 & x2
for(i=1 ; i < div_1.size ; i++)
{
#servers = div_1[i-1]+1;
#needed_Units = x1/div_1[i];
last_ind = BS on cs to get minimum c greater than or equal needed_units
first_ind = last_ind - servers + 1
for(j=1 ; j < div_2.size ; j++)
{
#servers2 = div_2[i-1]+1;
#needed_Units2 = x2/div_2[i];
if(#servers2 >= first_ind)
last_ind2 = #servers2 - first_ind + last_ind
else
last_ind2 = #servers2 - 1
if(cs[last_ind2] >= needed_Units2)
Print();
return ;
}
}
cout << No;
c29sdXRpb24gZm9yIEQgCgpzb3J0IGNzIGFycmF5CmdldCBkaXZpc29ycyBvZiB4MSAmIHgyIAoKZm9yKGk9MSA7IGkgPCBkaXZfMS5zaXplIDsgaSsrKQp7Cgkjc2VydmVycyA9IGRpdl8xW2ktMV0rMTsKCSNuZWVkZWRfVW5pdHMgPSB4MS9kaXZfMVtpXTsKCQoJbGFzdF9pbmQgPSBCUyBvbiBjcyB0byBnZXQgbWluaW11bSBjIGdyZWF0ZXIgdGhhbiBvciBlcXVhbCBuZWVkZWRfdW5pdHMKCQoJZmlyc3RfaW5kID0gbGFzdF9pbmQgLSBzZXJ2ZXJzICsgMQoJCglmb3Ioaj0xIDsgaiA8IGRpdl8yLnNpemUgOyBqKyspCgl7CgkJI3NlcnZlcnMyID0gZGl2XzJbaS0xXSsxOwoJCSNuZWVkZWRfVW5pdHMyID0geDIvZGl2XzJbaV07CgkJCgkJaWYoI3NlcnZlcnMyID49IGZpcnN0X2luZCkKCQkJbGFzdF9pbmQyID0gI3NlcnZlcnMyIC0gZmlyc3RfaW5kICsgbGFzdF9pbmQKCQllbHNlCgkJCWxhc3RfaW5kMiA9ICNzZXJ2ZXJzMiAtIDEKCQkKCQlpZihjc1tsYXN0X2luZDJdID49IG5lZWRlZF9Vbml0czIpCgkJCVByaW50KCk7CgkJCXJldHVybiA7Cgl9Cn0KCmNvdXQgPDwgTm87
Main.java:1: error: class, interface, or enum expected
solution for D
^
Main.java:6: error: class, interface, or enum expected
for(i=1 ; i < div_1.size ; i++)
^
Main.java:6: error: class, interface, or enum expected
for(i=1 ; i < div_1.size ; i++)
^
Main.java:9: error: illegal character: '#'
#servers = div_1[i-1]+1;
^
Main.java:10: error: illegal character: '#'
#needed_Units = x1/div_1[i];
^
Main.java:10: error: class, interface, or enum expected
#needed_Units = x1/div_1[i];
^
Main.java:12: error: class, interface, or enum expected
last_ind = BS on cs to get minimum c greater than or equal needed_units
^
Main.java:16: error: class, interface, or enum expected
for(j=1 ; j < div_2.size ; j++)
^
Main.java:16: error: class, interface, or enum expected
for(j=1 ; j < div_2.size ; j++)
^
Main.java:19: error: illegal character: '#'
#servers2 = div_2[i-1]+1;
^
Main.java:20: error: illegal character: '#'
#needed_Units2 = x2/div_2[i];
^
Main.java:20: error: class, interface, or enum expected
#needed_Units2 = x2/div_2[i];
^
Main.java:22: error: class, interface, or enum expected
if(#servers2 >= first_ind)
^
Main.java:22: error: illegal character: '#'
if(#servers2 >= first_ind)
^
Main.java:23: error: illegal character: '#'
last_ind2 = #servers2 - first_ind + last_ind
^
Main.java:25: error: illegal character: '#'
last_ind2 = #servers2 - 1
^
Main.java:29: error: class, interface, or enum expected
return ;
^
Main.java:30: error: class, interface, or enum expected
}
^
18 errors