Submission #2545170


Source Code Expand

#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <limits>
#include <cmath>
#include <numeric>
#include <string>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
#define rep(i, a, b) for(int i = (a); i < (b); ++i )
#define rrep(i, a, b) for(int i = (a); i > (b); --i )
#define REP(i, a, b) for(int i = (a); i <= (b); ++i )
#define RREP(i, a, b) for(int i = (a); i >= (b); --i )
#define llrep(i, a, b) for(ll i = (a); i < (b); ++i )
#define llrrep(i, a, b) for(ll i = (a); i > (b); --i )
#define llREP(i, a, b) for(ll i = (a); i <= (b); ++i )
#define llRREP(i, a, b) for(ll i = (a); i >= (b); --i )
#define ullrep(i, a, b) for(ull i = (a); i < (b); ++i )
#define ullrrep(i, a, b) for(ull i = (a); i > (b); --i )
#define ullREP(i, a, b) for(ull i = (a); i <= (b); ++i )
#define ullRREP(i, a, b) for(ull i = (a); i >= (b); --i )


int N, K;
int X[100010];
int Y[100010];
int C[100010];
int KK[1000*1000];


int main() {
    cin >> N >> K;
    rep(i, 0, N) {
        char c;
        cin >> X[i] >> Y[i] >> c;
        if(c == 'B') {
            C[i] = 1;
        }else{
            C[i] = 0;
        }
    }

    int firstTgt = C[0];
    int t = 0;
    rep(xshift, 0, K)
    rep(yshift, 0, K) {
        int cnt = 1;
        int neg = 0;
        for (int i=1; i < N; i++) {
            int xn = (X[i]-X[0] + xshift) / K % 2;
            int yn = (Y[i]-Y[0] + yshift) / K % 2;
            if (xn == yn) {
                if (C[i] == firstTgt) {
                    cnt++;
                }else{
                    neg++;
                }
            }else{
                if (C[i] != firstTgt) {
                    cnt++;
                }else{
                    neg++;
                }
            }
        }
//        cout << cnt << ", " << neg << endl;
        KK[t++] = max(cnt, neg);
    }
    cout << *max_element(KK, KK+t) << endl;
}

Submission Info

Submission Time
Task D - Checker
User pshiko
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1985 Byte
Status WA
Exec Time 2103 ms
Memory 4224 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 3
AC × 17
WA × 8
TLE × 6
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 256 KB
0_001.txt AC 12 ms 4224 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 4 ms 4224 KB
1_004.txt AC 1 ms 256 KB
1_005.txt AC 1 ms 256 KB
1_006.txt AC 1 ms 256 KB
1_007.txt AC 1 ms 256 KB
1_008.txt AC 4 ms 4224 KB
1_009.txt WA 4 ms 256 KB
1_010.txt WA 4 ms 256 KB
1_011.txt WA 4 ms 256 KB
1_012.txt WA 127 ms 256 KB
1_013.txt TLE 2103 ms 3200 KB
1_014.txt WA 238 ms 1408 KB
1_015.txt WA 244 ms 1408 KB
1_016.txt WA 283 ms 1408 KB
1_017.txt TLE 2103 ms 1408 KB
1_018.txt TLE 2103 ms 1408 KB
1_019.txt AC 778 ms 384 KB
1_020.txt AC 778 ms 384 KB
1_021.txt AC 777 ms 384 KB
1_022.txt AC 778 ms 384 KB
1_023.txt AC 773 ms 384 KB
1_024.txt AC 772 ms 384 KB
1_025.txt WA 344 ms 1408 KB
1_026.txt TLE 2103 ms 1408 KB
1_027.txt AC 350 ms 1408 KB
1_028.txt TLE 2103 ms 1408 KB
1_029.txt AC 345 ms 1408 KB
1_030.txt TLE 2103 ms 1408 KB