Submission #6518870
Source Code Expand
#include <iostream> #include <algorithm> using std::cout; using std::endl; using std::cin; using std::max; int X[100'010]; int Y[100'010]; const bool WHITE = true; const bool BLACK = !WHITE; bool C[100'010]; int plane[2'010][2'010]; int main() { // Input int N; int K; cin >> N >> K; const int k2 = 2 * K; for(int i = 0; i < N; ++i) { char c; cin >> X[i] >> Y[i] >> c; X[i] %= k2; Y[i] %= k2; C[i] = c == 'W'? WHITE : BLACK; } // Preparation int blackCount = 0; for(int i = 0; i < N; ++i) { C[i] += (X[i] / K) + (Y[i] / K); X[i] %= K; Y[i] %= K; plane[X[i]][Y[i]] += (C[i] == WHITE); if(C[i] == BLACK) ++blackCount; } for(int x = 0; x < K; ++x) for(int y = 1; y < K; ++y) plane[x][y] += plane[x][y-1]; for(int x = 1; x < K; ++x) for(int y = 0; y < K; ++y) plane[x][y] += plane[x-1][y]; // Calculation int ans = 0; for(int x = 0; x < K; ++x) for(int y = 0; y < K; ++y) { int w = plane[K-1][K-1] - plane[x][K-1] - plane[K-1][y] + plane[x][y] * 2 + blackCount; ans = max(ans, max(w, N-w)); } // Output cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Checker |
User | TeaMouse |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1149 Byte |
Status | WA |
Exec Time | 120 ms |
Memory | 10752 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 | 2 ms | 2304 KB |
0_001.txt | AC | 8 ms | 10496 KB |
0_002.txt | WA | 1 ms | 2304 KB |
1_003.txt | AC | 8 ms | 10496 KB |
1_004.txt | AC | 1 ms | 2304 KB |
1_005.txt | AC | 1 ms | 2304 KB |
1_006.txt | AC | 1 ms | 2304 KB |
1_007.txt | AC | 2 ms | 2688 KB |
1_008.txt | AC | 9 ms | 10496 KB |
1_009.txt | WA | 3 ms | 2304 KB |
1_010.txt | WA | 3 ms | 2304 KB |
1_011.txt | WA | 3 ms | 2304 KB |
1_012.txt | WA | 3 ms | 2688 KB |
1_013.txt | WA | 10 ms | 10496 KB |
1_014.txt | WA | 113 ms | 2560 KB |
1_015.txt | WA | 115 ms | 2560 KB |
1_016.txt | WA | 113 ms | 2560 KB |
1_017.txt | WA | 115 ms | 3072 KB |
1_018.txt | WA | 120 ms | 10752 KB |
1_019.txt | AC | 7 ms | 2688 KB |
1_020.txt | AC | 7 ms | 2688 KB |
1_021.txt | AC | 7 ms | 2688 KB |
1_022.txt | AC | 7 ms | 2688 KB |
1_023.txt | WA | 7 ms | 2688 KB |
1_024.txt | WA | 7 ms | 2688 KB |
1_025.txt | WA | 81 ms | 2560 KB |
1_026.txt | WA | 103 ms | 10752 KB |
1_027.txt | WA | 80 ms | 2560 KB |
1_028.txt | WA | 86 ms | 10752 KB |
1_029.txt | WA | 80 ms | 2560 KB |
1_030.txt | WA | 88 ms | 10752 KB |