Created
June 3, 2021 01:00
-
-
Save sakapon/020f3f8c35a09e2631fc86829dc2435d to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q048
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() | |
{ | |
var (n, k) = Read2(); | |
Console.WriteLine(new bool[n].Select(_ => ReadL()).SelectMany(p => new[] { p[0] - p[1], p[1] }).OrderByDescending(x => x).Take(k).Sum()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://atcoder.jp/contests/typical90/submissions/23141428