Submission #2119514


Source Code Expand

#include <bits/stdc++.h>
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)

using namespace std;

int n, k;


int arr[2001][2001];
int arr_doubled[4001][4001];
int get(int y, int x){ 
  return arr_doubled[y+k-1][x+k-1]+arr_doubled[y-1][x-1]-arr_doubled[y-1][x+k-1]-arr_doubled[y+k-1][x-1];
}
int main() {
  /*int n = 2;
  int m = 4;
  int sum = 0;
  for (int i=1; i<=n; i++){
    int x = m*(m+1)/2;
    sum += n*m*m-n*x+m*n-i*m*m+i*x-m*i+m*m-x+m;
  }
  cout << sum;*/
  cin >> n >> k;
 
  repp(i,0, n){
    int x, y;
    char c;
    cin >> x >> y >> c;
    if (c == 'W'){
      x += k;
    }
   
    arr[y%(2*k)][x%(2*k)]++;
  }
  
  repp(i, 0, 4*k){
    repp(j, 0, 4*k){
      arr_doubled[i][j] = arr_doubled[i][j-1]+arr[i%(2*k)][j%(2*k)];
    }
  }
 
  repp(i, 0, 4*k){
    repp(j, 1, 4*k){
      arr_doubled[j][i] += arr_doubled[j-1][i];
    }
  }
  /*for (int i=1; i<4*k+1; i++){
    for (int j=1; j<4*k+1; j++){
      cout << arr_doubled[i][j] << " ";
    }
    cout << endl;
  }*/
  int biggest = -1;
  repp(i, 0, 2*k+1){
    repp(j, 0, 2*k+1){
      biggest = max(get(i, j)+get(i+k, j+k), biggest);
      
    }
  }
  cout << biggest;
  return 0;
}

Submission Info

Submission Time
Task D - Checker
User CatDog456
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1229 Byte
Status RE
Exec Time 346 ms
Memory 78464 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
RE × 3
RE × 31
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 RE 98 ms 2304 KB
0_001.txt RE 224 ms 63744 KB
0_002.txt RE 100 ms 2304 KB
1_003.txt RE 223 ms 63744 KB
1_004.txt RE 98 ms 2304 KB
1_005.txt RE 99 ms 2304 KB
1_006.txt RE 99 ms 2432 KB
1_007.txt RE 103 ms 9216 KB
1_008.txt RE 227 ms 65792 KB
1_009.txt RE 102 ms 2304 KB
1_010.txt RE 100 ms 2304 KB
1_011.txt RE 102 ms 2432 KB
1_012.txt RE 105 ms 11264 KB
1_013.txt RE 228 ms 78080 KB
1_014.txt RE 211 ms 2304 KB
1_015.txt RE 210 ms 2304 KB
1_016.txt RE 212 ms 2432 KB
1_017.txt RE 212 ms 11264 KB
1_018.txt RE 346 ms 78464 KB
1_019.txt RE 110 ms 9216 KB
1_020.txt RE 108 ms 9216 KB
1_021.txt RE 107 ms 9216 KB
1_022.txt RE 106 ms 9216 KB
1_023.txt RE 107 ms 9216 KB
1_024.txt RE 108 ms 9216 KB
1_025.txt RE 176 ms 2432 KB
1_026.txt RE 319 ms 67840 KB
1_027.txt RE 176 ms 2432 KB
1_028.txt RE 305 ms 78336 KB
1_029.txt RE 176 ms 2432 KB
1_030.txt RE 302 ms 63744 KB