
10
7 9 6
7 4 29
4 0 12
6 2 30
2 4 50
3 1 39
7 5 6
9 2 18
10 8 6
3 1 5record3 1 393 1 5RaceTotalSecondsusing System;
using System.IO;
namespace Beadando2;
class Program{
static void Main(string[] args){
FileStream fs = new FileStream("be2.txt", FileMode.Open);
StreamReader sr = new StreamReader(fs);
int n = Convert.ToInt32(sr.ReadLine());
int[] H = new int[n];
int[] P = new int[n];
int[] Mp= new int[n];
int temp = 0;
while(!sr.EndOfStream)
{
string[] line = sr.ReadLine().Split(' ');
H[temp]=Convert.ToInt32(line[0]);
P[temp]=Convert.ToInt32(line[1]);
Mp[temp]=Convert.ToInt32(line[2]);
temp++;
}
sr.Close();
fs.Close();
int[] ki=new int[2];
temp = 0;
for(int i=1;i<n;i++){
if(H[temp]>3){
temp=i;
continue;
}
if(H[i]<=3){
if(P[i]*60+Mp[i] > P[temp]*60+Mp[temp]){
temp=i;
}
}
}
ki[0]=temp;
temp = 0;
for(int i=1;i<n;i++){
if(H[temp]>3){
temp=i;
continue;
}
if(H[i]<=3){
if(P[i]*60+Mp[i] < P[temp]*60+Mp[temp]){
temp=i;
}
}
}
ki[1] = temp;
Console.WriteLine((ki[0]+1) + " " + (ki[1]+1));
}
}var i = 0;
var races = File.ReadAllLines(ArchionFileName)
.Skip(1) // skip header
.Select(x => (content: x, index: i++)) // add index, so we can output it later
.Select(x => Race.FromString(x.content, x.index));
var top3 = races.Where(x => x.Placement <= 3).ToList(); // we only care about races where we finished top 3
var fastest = top3.MinBy(x => x.TotalSeconds);
var slowest = top3.MaxBy(x => x.TotalSeconds);
Console.WriteLine($"The fastest race was {fastest.Index} with {fastest.TotalSeconds} seconds");
Console.WriteLine($"The slowest race was {slowest.Index} with {slowest.TotalSeconds} seconds");