Submission #3377478
Source Code Expand
using System; using System.Linq;//リストの使用 using System.Collections.Generic; class Program { static void Main() { long n = long.Parse(Console.ReadLine());//int.Parseは文字列を整数に変換。 long[][] nums = new long[2*n][];//座標と種類 long memo = 0; long answer = 1; for(long i = 0; i < n; i++) { nums[i] = new long[2]; nums[i][0] = long.Parse(Console.ReadLine()); nums[i][1] = 0; } for(long i = n; i < 2*n; i++) { nums[i] = new long[2]; nums[i][0] = long.Parse(Console.ReadLine()); nums[i][1] = 1; } Array.Sort(vertexes, (a, b) => a[0].CompareTo(b[0])); for(long i = 0; i < 2*n; i++) { if(nums[i][1] == 0) memo++; else memo--; answer += Math.Max(0, Math.Abs(memo)-1); } Console.WriteLine(answer);//WriteLineをWriteとすると、改行なしで出力。 } }
Submission Info
Submission Time | |
---|---|
Task | A - 1D Matching |
User | suikameron |
Language | C# (Mono 4.6.2.0) |
Score | 0 |
Code Size | 936 Byte |
Status | CE |
Compile Error
./Main.cs(24,16): error CS0103: The name `vertexes' does not exist in the current context