This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace AlgorithmLab.DataTrees | |
{ | |
// 要素が重複しない (すべての値の順序が異なる) 場合に利用できます。 | |
public class DistinctPriorityQueue<T> | |
{ | |
// 要素をそのままキーとして使用します。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace AlgorithmLab.DataTrees | |
{ | |
public static class ComparerHelper | |
{ | |
public static IComparer<T> GetDefault<T>() | |
{ | |
// カルチャに依存しない場合に高速化します。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q074 | |
{ | |
static void Main() | |
{ | |
Console.ReadLine(); | |
Console.WriteLine(Console.ReadLine().Select((c, i) => (c - 'a') * (1L << i)).Sum()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q052 | |
{ | |
const long M = 1000000007; | |
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse); | |
static void Main() | |
{ | |
var n = int.Parse(Console.ReadLine()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Q050 | |
{ | |
const long M = 1000000007; | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); } | |
static void Main() | |
{ | |
var (n, l) = Read2(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q048 | |
{ | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); } | |
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse); | |
static void Main() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q046 | |
{ | |
const int M = 46; | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static void Main() | |
{ | |
var n = int.Parse(Console.ReadLine()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q036 | |
{ | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static (int x, int y) Read2() { var a = Read(); return (a[0], a[1]); } | |
static void Main() => Console.WriteLine(Solve()); | |
static object Solve() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
class Q030 | |
{ | |
static int[] Read() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse); | |
static (int, int) Read2() { var a = Read(); return (a[0], a[1]); } | |
static void Main() | |
{ | |
var (n, k) = Read2(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Q038 | |
{ | |
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse); | |
static (long, long) Read2L() { var a = ReadL(); return (a[0], a[1]); } | |
static void Main() => Console.WriteLine(Solve()); | |
static object Solve() | |
{ | |
var (a, b) = Read2L(); |
NewerOlder