ENG  RUS Timus Online Judge
Online Judge
Problems
Authors
Online contests
Site news
Webboard
Problem set
Submit solution
Judge status
Guide
Register
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

## Discussion of Problem 1203. Scientific Conference

Test #7 why?
Posted by AlexRad 6 Apr 2015 14:29
Why my programm does not pass test #7 ?

Give me please that test!

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Globalization;

namespace _1203.Научная_конференция
{
class Program
{
static void Main(string[] args)
{

var n = int.Parse(Console.ReadLine().Trim());

var reports = new List<Tuple<int, int>>(n);
for(var i = 0; i < n; i++)
{
var tokens = Console.ReadLine().Trim().
Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
}

reports.Sort();

var weights = new int[n];
var weight = -1;

var reportStartComparer = new ReportStartComparer();
for (var i = 0; i < n; i++)
{
if (weights[i] > weight)
weight = weights[i];

var nextReport = Tuple.Create(reports[i].Item2 + 1, 0);
var idx = reports.BinarySearch(nextReport, reportStartComparer);
if (idx < 0)
idx = ~idx;
if (idx < n && weights[idx] < weight + 1)
weights[idx] = weight + 1;
}

Console.WriteLine(weight + 1);
}
}

class ReportStartComparer: IComparer<Tuple<int, int>>
{
public int Compare(Tuple<int, int> x, Tuple<int, int> y)
{
return x.Item1 - y.Item1;
}
}
}