Skip to content

this[system.int32] is not resolved in int.Parse(input[1]); #596

Open

Description

@yaroj
Image

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

  1. VISTALL commented on Nov 5, 2025

    @VISTALL
    Member

    Hello. Can you say .NET version?

    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?
    

    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

  2. yaroj commented on Nov 5, 2025

    @yaroj
    Author

    presumably .net 8.0

    Image
  3. yaroj commented on Nov 5, 2025

    @yaroj
    Author

    yeah it is nightly

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions