-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathQHEAP1.cs
More file actions
27 lines (21 loc) · 713 Bytes
/
QHEAP1.cs
File metadata and controls
27 lines (21 loc) · 713 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// https://www.hackerrank.com/challenges/qheap1/problem
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static void Main(String[] args) {
var count = int.Parse(Console.ReadLine());
var list = new SortedList<int, bool>();
for (int index = 0; index < count; index++)
{
var command = Console.ReadLine();
var parts = command.Split(' ');
if (parts[0] == "1")
list.Add(int.Parse(parts[1]), false);
else if (parts[0] == "2")
list.Remove(int.Parse(parts[1]));
else if (parts[0] == "3")
Console.WriteLine(list.Keys[0]);
}
}
}