nicspy i like and appreciate that you make videos for us but I have only one complain which I guess others have made before and that is why don't you share your cf handle. If you do more people would appreciate and get to learn from you.
we feel somehow under pressure to perform well, when we know somebody is going to stock our performance, hope you can understand, the reason, Why i did't share the ID, 😊
less complex code for D import java.util.Scanner; public class main { public static void main(String[] args) { Scanner scn = new Scanner(System.in); int t = scn.nextInt(); while (t-- > 0) { int n = scn.nextInt(); long c = scn.nextLong(); // Changed to long long[] nums = new long[n]; // Changed to long long max = -1; int maxidx = -1; // Read the array and find the maximum value and its index for (int i = 0; i < n; i++) { nums[i] = scn.nextLong(); // Changed to nextLong() if (nums[i] > max) { max = nums[i]; maxidx = i; } } // Calculate prefix sums long[] presum = new long[n]; // Changed to long presum[0] = nums[0]; for (int i = 1; i < n; i++) { presum[i] = presum[i - 1] + nums[i]; } // Calculate maximum suffix values long[] maxsuf = new long[n]; // Changed to long maxsuf[n - 1] = nums[n - 1]; for (int i = n - 2; i >= 0; i--) { maxsuf[i] = Math.max(maxsuf[i + 1], nums[i]); } boolean damm = false; if (nums[0] + c < max) { damm = true; } for (int i = 0; i < n; i++) { if (i == maxidx && damm) { System.out.print(0 + " "); } else if (presum[i] + c >= maxsuf[i]) { System.out.print(i + " "); } else { System.out.print((i + 1) + " "); } } System.out.println(); } } }
Came here after not getting the solution by tle eliminator, and became a subscriber, thank you 🎉
you are welcome buddy, thanks ✌️🌟
You and @TLE_Eliminators are the only masters that can demystify Division 2 Codeforce Challenges for dummies like me ❤ from NYU 🗽
glad to hear that ❤😊
Thank you much for diving into challenging Division 2s Sensei 🙇♂️
its my pleasure to help you ❤
B solution:
void solve(){
int n,a,b;
cin>>n>>a>>b;
if(a >= b){
cout
nicspy i like and appreciate that you make videos for us but I have only one complain which I guess others have made before and that is why don't you share your cf handle. If you do more people would appreciate and get to learn from you.
we feel somehow under pressure to perform well, when we know somebody is going to stock our performance, hope you can understand, the reason, Why i did't share the ID, 😊
D was somehow easier than C, C was unusually hard for a C, D was unusually easy for a D.
I actually found C easier than usual. Most of the time I need the editorial to solve C. But this time I could solve it on my own.
This was probably the easiest C in CF div 2 history tbh
less complex code for D
import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int t = scn.nextInt();
while (t-- > 0) {
int n = scn.nextInt();
long c = scn.nextLong(); // Changed to long
long[] nums = new long[n]; // Changed to long
long max = -1;
int maxidx = -1;
// Read the array and find the maximum value and its index
for (int i = 0; i < n; i++) {
nums[i] = scn.nextLong(); // Changed to nextLong()
if (nums[i] > max) {
max = nums[i];
maxidx = i;
}
}
// Calculate prefix sums
long[] presum = new long[n]; // Changed to long
presum[0] = nums[0];
for (int i = 1; i < n; i++) {
presum[i] = presum[i - 1] + nums[i];
}
// Calculate maximum suffix values
long[] maxsuf = new long[n]; // Changed to long
maxsuf[n - 1] = nums[n - 1];
for (int i = n - 2; i >= 0; i--) {
maxsuf[i] = Math.max(maxsuf[i + 1], nums[i]);
}
boolean damm = false;
if (nums[0] + c < max) {
damm = true;
}
for (int i = 0; i < n; i++) {
if (i == maxidx && damm) {
System.out.print(0 + " ");
} else if (presum[i] + c >= maxsuf[i]) {
System.out.print(i + " ");
} else {
System.out.print((i + 1) + " ");
}
}
System.out.println();
}
}
}
thanks ❤️
Bro whats ur cf handle?
Let me check 😅