Submission #3389682


Source Code Expand

using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');//Splitで区切り文字を指定して複数個受け取る。
		long n = long.Parse(input[0]);
		long k = long.Parse(input[1]);
    long[,] vertexes = new long[n,2];
    long[,] masses = new long[2*k,2*k];
    long answer = 0;
    for(long i = 0; i < n; i++)
    {
      var nums = Console.ReadLine().Split(' ');//1行ごとに受け取る
      vertexes[i,0] = long.Parse(nums[0]);
      vertexes[i,1] = long.Parse(nums[1]);
      vertexes[i,0] %= 2 * k;
      vertexes[i,1] %= 2 * k;
      if(nums[2] == "W")
      {
        if(vertexes[i,0] < k) vertexes[i,0] += k;//WをBに反転
        else vertexes[i,0] -= k;
      }
    
      masses[vertexes[i,0], vertexes[i,1]]++;
      if(vertexes[i,0]<k) masses[vertexes[i,0]+k, vertexes[i,1]]--;
      if(vertexes[i,1]<k) masses[vertexes[i,0], vertexes[i,1]+k]--;
      if(vertexes[i,0]<k && vertexes[i,1]<k)masses[vertexes[i,0]+k, vertexes[i,1]+k]++;
      
      if(vertexes[i,0]>0 && vertexes[i,1]>0)//左下
      {
        masses[0, 0]++;
        masses[vertexes[i,0], vertexes[i,1]]++;
        masses[0, vertexes[i,1]]--;
        masses[vertexes[i,0], 0]--;
      }
      if(vertexes[i,0]>0 && vertexes[i,1]<k)//左上
      {
        masses[0, vertexes[i,1]+k]++;
        masses[vertexes[i,0], vertexes[i,1]+k]--;
      }
      if(vertexes[i,0]<k && vertexes[i,1]<k)//右上
      {
        masses[vertexes[i,0]+k, vertexes[i,1]+k]++;
      }
      if(vertexes[i,0]<k && vertexes[i,1]>0)//右下
      {
        masses[vertexes[i,0]+k, vertexes[i,1]]--;
        masses[vertexes[i,0]+k, 0]++;
      }

    }

    for(long i = 1; i < 2*k; i++)//右側へたす
    {
      for(long j = 0; j < 2*k; j++)
      {
        masses[i,j] += masses[i-1,j];
      }
    }

    for(long j = 1; j < 2*k; j++)//上側へたす
    {
      for(long i = 0; i < 2*k; i++)
      {
        masses[i,j] += masses[i,j-1];
      }
    }

    for(long i = 0; i < 2*k; i++)
    {
      for(long j = 0; j < 2*k; j++)
      {
        answer = Math.Max(answer, masses[i,j]);
        answer = Math.Max(answer, n-masses[i,j]);//色の逆転
      }
    }
    
		Console.WriteLine(answer);
	}
}

Submission Info

Submission Time
Task D - Checker
User suikameron
Language C# (Mono 4.6.2.0)
Score 0
Code Size 2382 Byte
Status WA
Exec Time 250 ms
Memory 47808 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 17
WA × 14
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt
Case Name Status Exec Time Memory
0_000.txt AC 21 ms 11220 KB
0_001.txt AC 106 ms 42208 KB
0_002.txt AC 21 ms 9172 KB
1_003.txt AC 105 ms 42208 KB
1_004.txt AC 21 ms 9172 KB
1_005.txt AC 21 ms 11220 KB
1_006.txt AC 21 ms 9172 KB
1_007.txt AC 22 ms 9184 KB
1_008.txt AC 105 ms 42208 KB
1_009.txt AC 23 ms 9148 KB
1_010.txt WA 22 ms 11196 KB
1_011.txt WA 23 ms 9148 KB
1_012.txt WA 23 ms 9312 KB
1_013.txt WA 107 ms 42208 KB
1_014.txt AC 152 ms 16576 KB
1_015.txt WA 157 ms 14528 KB
1_016.txt WA 152 ms 14528 KB
1_017.txt WA 154 ms 14908 KB
1_018.txt WA 250 ms 45756 KB
1_019.txt AC 32 ms 11488 KB
1_020.txt AC 33 ms 11488 KB
1_021.txt AC 33 ms 13536 KB
1_022.txt AC 33 ms 11488 KB
1_023.txt WA 34 ms 15584 KB
1_024.txt WA 33 ms 13536 KB
1_025.txt WA 139 ms 14532 KB
1_026.txt WA 226 ms 47804 KB
1_027.txt AC 132 ms 14532 KB
1_028.txt AC 217 ms 45888 KB
1_029.txt WA 134 ms 16580 KB
1_030.txt WA 224 ms 47808 KB