Submission #3381083


Source Code Expand

#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cmath>
#include<string>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define MOD 1000000007

using namespace std;
 
typedef long long int ll;

const ll INF=(ll)1e18;

int s[6000][6000];
int b[2000][2000];


int main(){
    int N,K;

    cin >> N >> K;

    REP(i,6000)REP(j,6000)s[i][j] = 0;

    REP(i,N){
        ll x,y;
        char c;
        cin >> x >> y >> c;

        if(c == 'W') y += K;
        b[x%(2*K)][y%(2*K)] += 1;
    }
    REP(i,2*K)REP(j,2*K){
        if(b[i][j] == 0)continue;

        REP(k,2)REP(l,2){
            s[i+1+2*K*k][j+1+2*K*l] += b[i][j];
            s[i+K+1+2*K*k][j+K+1+2*K*l] += b[i][j];
            s[i+K+1+2*K*k][j+1+2*K*l] -= b[i][j];
            s[i+1+2*K*k][j+K+1+2*K*l] -= b[i][j];
        }
    }

    REP(i,4*K+2)FOR(j,1,4*K+2)s[i][j] += s[i][j-1];
    REP(i,4*K+2)FOR(j,1,4*K+2)s[j][i] += s[j-1][i];

    ll ans = 0;
    FOR(i,1,2*K+1)FOR(j,1,2*K+1){
        ll tmp = 0;
        tmp += s[i][j];
        tmp += s[i+K][j+K];
        ans = max(ans,tmp);
    }

    cout << ans << endl;
}

Submission Info

Submission Time
Task D - Checker
User taka99
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1197 Byte
Status WA
Exec Time 240 ms
Memory 156544 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 28
WA × 3
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 42 ms 142208 KB
0_001.txt AC 134 ms 142208 KB
0_002.txt AC 42 ms 142208 KB
1_003.txt AC 134 ms 142208 KB
1_004.txt AC 42 ms 142208 KB
1_005.txt AC 42 ms 142208 KB
1_006.txt AC 42 ms 142208 KB
1_007.txt AC 43 ms 142208 KB
1_008.txt AC 135 ms 144256 KB
1_009.txt AC 43 ms 142208 KB
1_010.txt AC 43 ms 142208 KB
1_011.txt AC 43 ms 142208 KB
1_012.txt WA 44 ms 143104 KB
1_013.txt AC 138 ms 155008 KB
1_014.txt AC 130 ms 142208 KB
1_015.txt AC 129 ms 142208 KB
1_016.txt WA 129 ms 142208 KB
1_017.txt AC 131 ms 143104 KB
1_018.txt WA 240 ms 156544 KB
1_019.txt AC 48 ms 142592 KB
1_020.txt AC 48 ms 142592 KB
1_021.txt AC 47 ms 142592 KB
1_022.txt AC 48 ms 142592 KB
1_023.txt AC 48 ms 142592 KB
1_024.txt AC 48 ms 142592 KB
1_025.txt AC 106 ms 142208 KB
1_026.txt AC 211 ms 144256 KB
1_027.txt AC 107 ms 142208 KB
1_028.txt AC 199 ms 142208 KB
1_029.txt AC 107 ms 142208 KB
1_030.txt AC 203 ms 156544 KB