Submission #2123762
Source Code Expand
#include <stdio.h>
#include <algorithm>
const int max_n = 1e5;
const int max_k = 1000;
int a[3 * max_k][3 * max_k];
int s[2][max_k][max_k];
void print(int n, int m) {
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
printf("%d ", a[i][j]);
}
printf("\n");
}
printf("--------------------\n");
}
int main() {
int N, K;
scanf("%d %d", &N, &K);
for (int i = 0; i < 3 * K; i++) {
for (int j = 0; j < 3 * K; j++) {
a[i][j] = 0;
}
}
for (int i = 0; i < K; ++i) {
for (int j = 0; j < K; ++j) {
s[0][i][j] = 0;
s[1][i][j] = 0;
}
}
for (int i = 0; i < N; ++i) {
int x, y;
char c;
scanf("%d %d %c", &x, &y, &c);
if (c == 'W') {
y += K;
}
x %= 2 * K;
y %= 2 * K;
a[x][y] += 1;
a[x + K][y + K] += 1;
a[x + K][y] -= 1;
a[x][y + K] -= 1;
}
//print(3 * K, 3 * K);
for (int i = 0; i < 3 * K; ++i) {
for (int j = 1; j < 3 * K; ++j) {
a[i][j] += a[i][j - 1];
}
}
//print(3 * K, 3 * K);
for (int i = 1; i < 3 * K; ++i) {
for (int j = 0; j < 3 * K; ++j) {
a[i][j] += a[i - 1][j];
}
}
//print(3 * K, 3 * K);
for(int i = 0; i < 3 * K; ++i) {
for(int j = 0; j < 3 * K; ++j) {
int p = (i / K + j / K) % 2;
s[p][i % K][j % K] += a[i][j];
}
}
int ans = 0;
for(int p = 0; p < 2; ++p) {
for (int i = 0; i < 2 * K; ++i) {
for (int j = 0; j < 2 * K; ++j) {
ans = std::max(ans, s[p][i][j]);
}
}
}
printf("%d\n", ans);
return 0;
}
Submission Info
Submission Time |
|
Task |
D - Checker |
User |
mamurai |
Language |
C++14 (GCC 5.4.1) |
Score |
500 |
Code Size |
1854 Byte |
Status |
AC |
Exec Time |
121 ms |
Memory |
43136 KB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:21:27: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d", &N, &K);
^
./Main.cpp:36:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %c", &x, &y, &c);
^
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 |
1 ms |
4224 KB |
0_001.txt |
AC |
87 ms |
43136 KB |
0_002.txt |
AC |
1 ms |
4224 KB |
1_003.txt |
AC |
87 ms |
43136 KB |
1_004.txt |
AC |
1 ms |
4224 KB |
1_005.txt |
AC |
1 ms |
4224 KB |
1_006.txt |
AC |
1 ms |
4224 KB |
1_007.txt |
AC |
3 ms |
10752 KB |
1_008.txt |
AC |
87 ms |
43136 KB |
1_009.txt |
AC |
2 ms |
4224 KB |
1_010.txt |
AC |
2 ms |
4224 KB |
1_011.txt |
AC |
2 ms |
4224 KB |
1_012.txt |
AC |
4 ms |
10752 KB |
1_013.txt |
AC |
87 ms |
43136 KB |
1_014.txt |
AC |
27 ms |
4224 KB |
1_015.txt |
AC |
27 ms |
4224 KB |
1_016.txt |
AC |
27 ms |
4224 KB |
1_017.txt |
AC |
30 ms |
10880 KB |
1_018.txt |
AC |
121 ms |
43136 KB |
1_019.txt |
AC |
5 ms |
10752 KB |
1_020.txt |
AC |
5 ms |
10752 KB |
1_021.txt |
AC |
5 ms |
10752 KB |
1_022.txt |
AC |
5 ms |
10752 KB |
1_023.txt |
AC |
5 ms |
10752 KB |
1_024.txt |
AC |
5 ms |
10752 KB |
1_025.txt |
AC |
23 ms |
4352 KB |
1_026.txt |
AC |
110 ms |
43136 KB |
1_027.txt |
AC |
23 ms |
4224 KB |
1_028.txt |
AC |
109 ms |
43136 KB |
1_029.txt |
AC |
23 ms |
4224 KB |
1_030.txt |
AC |
110 ms |
43136 KB |