Skip to content

Instantly share code, notes, and snippets.

@sakapon
Created June 1, 2021 02:02
Show Gist options
  • Save sakapon/5f8ac1fcc9436a6bccc81663e297ef38 to your computer and use it in GitHub Desktop.
Save sakapon/5f8ac1fcc9436a6bccc81663e297ef38 to your computer and use it in GitHub Desktop.
競プロ典型 90 問 / Q014
using System;
using System.Linq;
class Q014
{
static long[] ReadL() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
static void Main()
{
var n = int.Parse(Console.ReadLine());
var a = ReadL();
var b = ReadL();
Array.Sort(a);
Array.Sort(b);
Console.WriteLine(a.Zip(b, (x, y) => Math.Abs(x - y)).Sum());
}
}
@sakapon
Copy link
Author

sakapon commented Jun 1, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment