You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
this[system.int32] is not resolved in int.Parse(input[1]); #596
this works fine in visual studio
with example input
4
2 37
3 45
1 46
4 30
output in vs is 232
in Consulo when I try to run it. it runs what code was there previously is it bug or feature that makes it run last succesfull code?
if feature then how do I disable it?
`
using System;
using System.IO;
using System.Linq;
public class Program
{
struct Trip : IComparable<Trip>
{
public int cost;
public int days;
public int CompareTo(Trip other)
{
return -this.cost.CompareTo(other.cost);
}
}
public static void Main()
{
int n = int.Parse(Console.ReadLine());
var trips = new Trip[n];
for (int i = 0; i < n; i++)
{
var input = Console.ReadLine().Split(' ');
trips[i].cost = int.Parse(input[1]);
trips[i].days = int.Parse(input[0]);
}
Array.Sort(trips);//sort by cost descending
int[,] totalProfit = new int[n + 1, n + 1];
int maxProfit = 0;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
totalProfit[i + 1, j + 1] =
Math.Max(totalProfit[i, j] + trips[i].cost * (trips[i].days - j),
totalProfit[i + 1, j + 1]);
totalProfit[i + 1, j] =
Math.Max(totalProfit[i + 1, j],
totalProfit[i, j]);
maxProfit = Math.Max(maxProfit, totalProfit[i + 1, j + 1]);
}
}
Console.WriteLine(maxProfit);
}
Activity
VISTALL commentedon Nov 5, 2025
Hello. Can you say .NET version?
Looks like bug - it's nightly version?
I will check it after some week, I'm in progress of relocation, and don't have access to my dev machine (only code reviewing :()
Thanks
yaroj commentedon Nov 5, 2025
presumably .net 8.0
yaroj commentedon Nov 5, 2025
yeah it is nightly