Submission #4023281


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
const ll INF = 5e15;
const ll MOD = 1e9 + 7;

ll N, K;
vector<vector<ll>> imos;

int main(){
    cin >> N >> K;
    imos = decltype(imos)(1010, vector<ll>(2010));
    for(ll HOPE = 0; HOPE < N; HOPE++){
#if 0
        imos = decltype(imos)(1010, vector<ll>(2010));
#endif
        ll x, y;
        char c;
        cin >> x >> y >> c;
        x %= 2 * K;
        y %= 2 * K;
        if(c == 'W') y += K;
        if(x >= K){
            x -= K;
            y += K;
        }
        y %= 2 * K;
        imos[x][y]++;
        imos[K][y]--;
        imos[x][min(2 * K, y + K)]--;
        imos[K][min(2 * K, y + K)]++;
        if(2 * K < y + K){
            ll dic = y - K;
            imos[x][0]++;
            imos[K][0]--;
            imos[x][dic]--;
            imos[K][dic]++;
        }
        if(x){
            y += K;
            y %= 2 * K;
            imos[0][y]++;
            imos[x][y]--;
            imos[x][min(2 * K, y + K)]--;
            imos[x][min(2 * K, y + K)]++;
            if(2 * K < y + K){
                ll dic = y - K;
                imos[0][0]++;
                imos[x][0]--;
                imos[0][dic]--;
                imos[x][dic]++;
            }
        }
#if 0
        for(ll x = 0; x <= K; x++) for(ll y = 0; y <= 2 * K; y++) imos[x + 1][y] += imos[x][y];
        for(ll y = 0; y <= 2 * K; y++) for(ll x = 0; x <= K; x++) imos[x][y + 1] += imos[x][y];
        for(ll i = 2 * K; i >= 0; i--){
            for(ll j = 0; j <= K; j++) cout << imos[j][i] << ' ';
            cout << endl;
        }
        cout << "\n=====================\n";
#endif
    }
    for(ll x = 0; x <= K; x++) for(ll y = 0; y <= 2 * K; y++) imos[x + 1][y] += imos[x][y];
    for(ll y = 0; y <= 2 * K; y++) for(ll x = 0; x <= K; x++) imos[x][y + 1] += imos[x][y];
#if 0
    for(ll i = 2 * K; i >= 0; i--){
        for(ll j = 0; j <= K; j++) cout << imos[j][i] << ' ';
        cout << endl;
    }
#endif
    ll ans = 0;
    for(ll x = 0; x < K; x++) for(ll y = 0; y < 2 * K; y++) ans = max(ans, imos[x][y]);
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Checker
User kcvlex
Language C++14 (GCC 5.4.1)
Score 0
Code Size 2223 Byte
Status WA
Exec Time 146 ms
Memory 16128 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 17
WA × 14
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 10 ms 16128 KB
0_001.txt AC 43 ms 16128 KB
0_002.txt AC 10 ms 16128 KB
1_003.txt AC 43 ms 16128 KB
1_004.txt AC 10 ms 16128 KB
1_005.txt AC 10 ms 16128 KB
1_006.txt AC 10 ms 16128 KB
1_007.txt AC 10 ms 16128 KB
1_008.txt AC 43 ms 16128 KB
1_009.txt AC 11 ms 16128 KB
1_010.txt WA 11 ms 16128 KB
1_011.txt WA 11 ms 16128 KB
1_012.txt WA 11 ms 16128 KB
1_013.txt WA 45 ms 16128 KB
1_014.txt AC 100 ms 16128 KB
1_015.txt WA 101 ms 16128 KB
1_016.txt WA 101 ms 16128 KB
1_017.txt WA 102 ms 16128 KB
1_018.txt WA 146 ms 16128 KB
1_019.txt AC 15 ms 16128 KB
1_020.txt AC 15 ms 16128 KB
1_021.txt AC 15 ms 16128 KB
1_022.txt AC 15 ms 16128 KB
1_023.txt WA 15 ms 16128 KB
1_024.txt WA 15 ms 16128 KB
1_025.txt WA 79 ms 16128 KB
1_026.txt WA 125 ms 16128 KB
1_027.txt AC 78 ms 16128 KB
1_028.txt AC 112 ms 16128 KB
1_029.txt WA 79 ms 16128 KB
1_030.txt WA 114 ms 16128 KB