Skip to content

Instantly share code, notes, and snippets.

View sakapon's full-sized avatar
💭
May the Codeforces be with you.

Keihō Sakapon sakapon

💭
May the Codeforces be with you.
View GitHub Profile
@sakapon
sakapon / BstPriorityQueue.cs
Last active December 26, 2021 09:43
AlgorithmSample / BstPriorityQueue
using System;
using System.Collections.Generic;
using System.Linq;
namespace AlgorithmLab.DataTrees
{
// 要素が重複しない (すべての値の順序が異なる) 場合に利用できます。
public class DistinctPriorityQueue<T>
{
// 要素をそのままキーとして使用します。
@sakapon
sakapon / ComparerHelper.cs
Last active December 25, 2021 05:22
AlgorithmSample / ComparerHelper
using System;
using System.Collections.Generic;
namespace AlgorithmLab.DataTrees
{
public static class ComparerHelper
{
public static IComparer<T> GetDefault<T>()
{
// カルチャに依存しない場合に高速化します。
@sakapon
sakapon / Q074.cs
Created June 27, 2021 12:06
競プロ典型 90 問 / Q074
using System;
using System.Linq;
class Q074
{
static void Main()
{
Console.ReadLine();
Console.WriteLine(Console.ReadLine().Select((c, i) => (c - 'a') * (1L << i)).Sum());
}
@sakapon
sakapon / Q052.cs
Created June 4, 2021 06:53
競プロ典型 90 問 / Q052
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());
@sakapon
sakapon / Q050.cs
Created June 4, 2021 06:41
競プロ典型 90 問 / Q050
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();
@sakapon
sakapon / Q048.cs
Created June 3, 2021 01:00
競プロ典型 90 問 / Q048
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()
{
@sakapon
sakapon / Q046.cs
Created June 3, 2021 00:14
競プロ典型 90 問 / Q046
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());
@sakapon
sakapon / Q036.cs
Created June 2, 2021 02:01
競プロ典型 90 問 / Q036
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()
{
@sakapon
sakapon / Q030.cs
Created June 2, 2021 01:51
競プロ典型 90 問 / Q030
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();
@sakapon
sakapon / Q038.cs
Created June 2, 2021 01:43
競プロ典型 90 問 / Q038
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();