Submission #3381098
Source Code Expand
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
using namespace std;
typedef long long int ll;
const ll INF=(ll)1e18;
int s[6000][6000];
int b[2000][2000];
int main(){
int N,K;
cin >> N >> K;
REP(i,6000)REP(j,6000)s[i][j] = 0;
REP(i,2000)REP(j,2000)b[i][j] = 0;
REP(i,N){
ll x,y;
char c;
cin >> x >> y >> c;
if(c == 'W') y += K;
b[x%(2*K)][y%(2*K)] += 1;
}
REP(i,2*K)REP(j,2*K){
if(b[i][j] == 0)continue;
REP(k,2)REP(l,2){
s[i+1+2*K*k][j+1+2*K*l] += b[i][j];
s[i+K+1+2*K*k][j+K+1+2*K*l] += b[i][j];
s[i+K+1+2*K*k][j+1+2*K*l] -= b[i][j];
s[i+1+2*K*k][j+K+1+2*K*l] -= b[i][j];
}
}
REP(i,4*K+2)FOR(j,1,4*K+2)s[i][j] += s[i][j-1];
REP(i,4*K+2)FOR(j,1,4*K+2)s[j][i] += s[j-1][i];
ll ans = 0;
FOR(i,1,2*K+1)FOR(j,1,2*K+1){
ll tmp = 0;
tmp += s[i][j];
tmp += s[i+K][j+K];
ans = max(ans,tmp);
}
cout << ans << endl;
}
Submission Info
Submission Time |
|
Task |
D - Checker |
User |
taka99 |
Language |
C++14 (GCC 5.4.1) |
Score |
0 |
Code Size |
1237 Byte |
Status |
WA |
Exec Time |
251 ms |
Memory |
156544 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 |
AC |
54 ms |
156544 KB |
0_001.txt |
AC |
148 ms |
156544 KB |
0_002.txt |
AC |
54 ms |
156544 KB |
1_003.txt |
AC |
147 ms |
156544 KB |
1_004.txt |
AC |
53 ms |
156544 KB |
1_005.txt |
AC |
53 ms |
156544 KB |
1_006.txt |
AC |
54 ms |
156544 KB |
1_007.txt |
AC |
55 ms |
156544 KB |
1_008.txt |
AC |
148 ms |
156544 KB |
1_009.txt |
AC |
54 ms |
156544 KB |
1_010.txt |
AC |
56 ms |
156544 KB |
1_011.txt |
AC |
54 ms |
156544 KB |
1_012.txt |
WA |
55 ms |
156544 KB |
1_013.txt |
AC |
149 ms |
156544 KB |
1_014.txt |
AC |
141 ms |
156544 KB |
1_015.txt |
AC |
141 ms |
156544 KB |
1_016.txt |
WA |
142 ms |
156544 KB |
1_017.txt |
AC |
143 ms |
156544 KB |
1_018.txt |
WA |
251 ms |
156544 KB |
1_019.txt |
AC |
61 ms |
156544 KB |
1_020.txt |
AC |
60 ms |
156544 KB |
1_021.txt |
AC |
59 ms |
156544 KB |
1_022.txt |
AC |
60 ms |
156544 KB |
1_023.txt |
AC |
59 ms |
156544 KB |
1_024.txt |
AC |
59 ms |
156544 KB |
1_025.txt |
AC |
118 ms |
156544 KB |
1_026.txt |
AC |
223 ms |
156544 KB |
1_027.txt |
AC |
120 ms |
156544 KB |
1_028.txt |
AC |
213 ms |
156544 KB |
1_029.txt |
AC |
120 ms |
156544 KB |
1_030.txt |
AC |
214 ms |
156544 KB |