Submission #3389605
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;
if(vertexes[i,1] < k) vertexes[i,1] += k;
else vertexes[i,1] -= k;
}
masses[vertexes[i,0], vertexes[i,1]]++;
masses[vertexes[i,0]+k, vertexes[i,1]]--;
masses[vertexes[i,0], 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]);
}
}
Console.WriteLine(answer);
}
}
Submission Info
Submission Time |
|
Task |
D - Checker |
User |
suikameron |
Language |
C# (Mono 4.6.2.0) |
Score |
0 |
Code Size |
2324 Byte |
Status |
RE |
Exec Time |
93 ms |
Memory |
42208 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 500 |
Status |
|
|
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 |
RE |
20 ms |
10592 KB |
0_001.txt |
RE |
20 ms |
12640 KB |
0_002.txt |
RE |
19 ms |
8544 KB |
1_003.txt |
AC |
91 ms |
42208 KB |
1_004.txt |
RE |
20 ms |
10592 KB |
1_005.txt |
RE |
20 ms |
10592 KB |
1_006.txt |
RE |
20 ms |
10592 KB |
1_007.txt |
RE |
20 ms |
10976 KB |
1_008.txt |
AC |
93 ms |
40160 KB |
1_009.txt |
RE |
20 ms |
10720 KB |
1_010.txt |
RE |
19 ms |
8672 KB |
1_011.txt |
RE |
20 ms |
10720 KB |
1_012.txt |
RE |
19 ms |
8928 KB |
1_013.txt |
RE |
20 ms |
10720 KB |
1_014.txt |
RE |
20 ms |
10592 KB |
1_015.txt |
RE |
20 ms |
12640 KB |
1_016.txt |
RE |
20 ms |
10592 KB |
1_017.txt |
RE |
20 ms |
10976 KB |
1_018.txt |
RE |
20 ms |
10720 KB |
1_019.txt |
AC |
32 ms |
11360 KB |
1_020.txt |
AC |
34 ms |
13408 KB |
1_021.txt |
RE |
21 ms |
13152 KB |
1_022.txt |
RE |
20 ms |
13152 KB |
1_023.txt |
RE |
20 ms |
11104 KB |
1_024.txt |
RE |
20 ms |
11104 KB |
1_025.txt |
RE |
20 ms |
10592 KB |
1_026.txt |
RE |
21 ms |
12640 KB |
1_027.txt |
RE |
20 ms |
10592 KB |
1_028.txt |
RE |
20 ms |
14816 KB |
1_029.txt |
RE |
20 ms |
10592 KB |
1_030.txt |
RE |
20 ms |
14688 KB |