AC!想不出题目要求的O(logn)。反正都要读取输入,O(n)还是需要的吧。
using System;
using System.Collections;
using System.Collections.Generic;
public class Program {
public static void Main() {
int n = int.Parse(Console.ReadLine());
int a = int.Parse(Console.ReadLine());
List<int> ret = new List<int>();
string line;
while ((line = System.Console.ReadLine ()) != null) {
string[] tokens = line.Split();
int id = int.Parse(tokens[0]);
int bt = int.Parse(tokens[1]);
int et = int.Parse(tokens[2]);
if (bt <= a && a <= et){
ret.Add(id);
}
}
if(ret.Count == 0){
Console.WriteLine("null");
return;
}
ret.Sort();
foreach(var id in ret){
Console.WriteLine(id);
}
}
}