Submission #2119485
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
// NOT MY CODE, FROM https://pitsbuffersolution.com/
int N,K;
int b[2002][2002];
int s[4002][4002];
int get(int x , int y){
return s[x+K-1][y+K-1] + s[x-1][y-1] - s[x-1][y+K-1] - s[x+K-1][y-1];
}
// NOT MY CODE, FROM https://pitsbuffersolution.com/
int main(){
cin >> N >> K;
repp(i,0,N){
int x,y;
char c;
cin >> x >> y >> c;
if(c=='W') y += K;
++b[x%(2*K)+1][y%(2*K)+1];
}
repp(i,1,4*K+1){
repp(j,1,4*K+1){
s[i][j] = s[i][j-1] + b[(i-1)%(2*K)+1][(j-1)%(2*K)+1];
}
}
repp(j,1,4*K+1){
repp(i,1,4*K+1){
s[i][j] += s[i-1][j];
}
}
int ans = 0;
repp(i,1,2*K+1){
repp(j,1,2*K+1){
ans = max(ans , get(i,j) + get(i+K,j+K));
}
}
cout << ans << endl;
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Checker |
User |
CatDog456 |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
1283 Byte |
Status |
AC |
Exec Time |
252 ms |
Memory |
78464 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
500 / 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 |
2 ms |
2304 KB |
0_001.txt |
AC |
134 ms |
63744 KB |
0_002.txt |
AC |
1 ms |
2304 KB |
1_003.txt |
AC |
134 ms |
63744 KB |
1_004.txt |
AC |
2 ms |
2304 KB |
1_005.txt |
AC |
2 ms |
2304 KB |
1_006.txt |
AC |
2 ms |
2432 KB |
1_007.txt |
AC |
4 ms |
9216 KB |
1_008.txt |
AC |
134 ms |
65792 KB |
1_009.txt |
AC |
3 ms |
2304 KB |
1_010.txt |
AC |
3 ms |
2304 KB |
1_011.txt |
AC |
3 ms |
2432 KB |
1_012.txt |
AC |
6 ms |
11264 KB |
1_013.txt |
AC |
138 ms |
78208 KB |
1_014.txt |
AC |
117 ms |
2304 KB |
1_015.txt |
AC |
114 ms |
2304 KB |
1_016.txt |
AC |
113 ms |
2432 KB |
1_017.txt |
AC |
118 ms |
11264 KB |
1_018.txt |
AC |
252 ms |
78464 KB |
1_019.txt |
AC |
9 ms |
9216 KB |
1_020.txt |
AC |
9 ms |
9216 KB |
1_021.txt |
AC |
10 ms |
9216 KB |
1_022.txt |
AC |
9 ms |
9216 KB |
1_023.txt |
AC |
9 ms |
9216 KB |
1_024.txt |
AC |
10 ms |
9216 KB |
1_025.txt |
AC |
79 ms |
2432 KB |
1_026.txt |
AC |
230 ms |
65792 KB |
1_027.txt |
AC |
81 ms |
2560 KB |
1_028.txt |
AC |
211 ms |
63744 KB |
1_029.txt |
AC |
80 ms |
2432 KB |
1_030.txt |
AC |
215 ms |
78464 KB |