Submission #2983559
Source Code Expand
#include<bits/stdc++.h> #define S 2010 using namespace std; using ll = int64_t; const ll INF = 1145148931919810; ll imos[S][S]; ll N, K; void update(ll x, ll y, ll v){ ll xl = max<ll>(0, min<ll>(x, S - 1)); ll yl = max<ll>(0, min<ll>(y, S - 1)); imos[xl][yl] += v; imos[xl + K][yl] -= v; imos[xl][yl + K] -= v; } int main(){ cin >> N >> K; for(ll i = 0; i < N; i++){ ll x, y; char c; cin >> x >> y >> c; x++; y++; x %= 2 * K + 1; y %= 2 * K + 1; update(x, y, c == 'B'); for(ll j = 0; j < 3; j++) for(ll k = 0; k < 3; k++){ if(j == 1 && k == 1) continue; ll xl = x + (j - 1) * K; ll yl = y + (k - 1) * K; if(2 * K < xl) xl -= 2 * K; else if(xl + K <= 0) xl += 2 * K; if(2 * K < yl) yl -= 2 * K; else if(yl + K <= 0) yl += 2 * K; update(xl, yl, c == 'B'); } } for(ll i = 0; i < S - 1; i ++) for(ll j = 0; j < S - 1; j++) imos[i + 1][j] += imos[i][j]; for(ll i = 0; i < S - 1; i ++) for(ll j = 0; j < S - 1; j++) imos[i][j + 1] += imos[i][j]; ll ans = 0; for(ll i = 0; i < S; i++) ans = max(ans, *max_element(&imos[i][0], &imos[i][S])); cout << ans / 2 << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Checker |
User | kcvlex |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1346 Byte |
Status | RE |
Exec Time | 142 ms |
Memory | 31744 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 | 19 ms | 31744 KB |
0_001.txt | AC | 19 ms | 31744 KB |
0_002.txt | AC | 19 ms | 31744 KB |
1_003.txt | RE | 114 ms | 6400 KB |
1_004.txt | WA | 19 ms | 31744 KB |
1_005.txt | WA | 19 ms | 31744 KB |
1_006.txt | WA | 19 ms | 31744 KB |
1_007.txt | WA | 19 ms | 31744 KB |
1_008.txt | RE | 99 ms | 6400 KB |
1_009.txt | WA | 20 ms | 31744 KB |
1_010.txt | WA | 20 ms | 31744 KB |
1_011.txt | WA | 20 ms | 31744 KB |
1_012.txt | WA | 20 ms | 31744 KB |
1_013.txt | RE | 101 ms | 6400 KB |
1_014.txt | WA | 138 ms | 31744 KB |
1_015.txt | WA | 140 ms | 31744 KB |
1_016.txt | WA | 138 ms | 31744 KB |
1_017.txt | WA | 142 ms | 31744 KB |
1_018.txt | RE | 97 ms | 256 KB |
1_019.txt | WA | 25 ms | 31744 KB |
1_020.txt | WA | 25 ms | 31744 KB |
1_021.txt | WA | 25 ms | 31744 KB |
1_022.txt | WA | 25 ms | 31744 KB |
1_023.txt | WA | 25 ms | 31744 KB |
1_024.txt | WA | 25 ms | 31744 KB |
1_025.txt | WA | 105 ms | 31744 KB |
1_026.txt | RE | 99 ms | 2304 KB |
1_027.txt | WA | 106 ms | 31744 KB |
1_028.txt | WA | 105 ms | 31744 KB |
1_029.txt | WA | 106 ms | 31744 KB |
1_030.txt | RE | 99 ms | 6400 KB |