consulo-csharp
consulo-csharp copied to clipboard
this[system.int32] is not resolved in int.Parse(input[1]);
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);
}
} `