Submission #60514972


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
int main() {
int h, w, d; cin >> h >> w >> d;
vector<vector<char>> s(h + 1, vector<char>(w + 1));
for (int i = 1; i <= h; i++)
for (int j = 1; j <= w; j++)
cin >> s[i][j];
int ans = 0;
for (int u = 1; u <= h; u++)
for (int v = 1; v <= w; v++)
for (int x = 1; x <= h; x++)
for (int y = 1; y <= w; y++) {
if (s[x][y] == '#' || s[u][v] == '#') continue;
int cnt = 0;
for (int i = 1; i <= h; i++)
for (int j = 1; j <= w; j++)
if (s[i][j] == '.' && (abs(i - x) + abs(j - y) <= d || abs(i - u) + abs(j - v) <= d)) cnt++;
ans = max(ans, cnt);
}
cout << ans << '\n';
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
using namespace std;
int main() {
  int h, w, d; cin >> h >> w >> d;
  vector<vector<char>> s(h + 1, vector<char>(w + 1));
  for (int i = 1; i <= h; i++)
    for (int j = 1; j <= w; j++)
      cin >> s[i][j];
  int ans = 0;
  for (int u = 1; u <= h; u++)
    for (int v = 1; v <= w; v++)
      for (int x = 1; x <= h; x++)
        for (int y = 1; y <= w; y++) {
          if (s[x][y] == '#' || s[u][v] == '#') continue;
          int cnt = 0;
          for (int i = 1; i <= h; i++)
            for (int j = 1; j <= w; j++)
              if (s[i][j] == '.' && (abs(i - x) + abs(j - y) <= d || abs(i - u) + abs(j - v) <= d)) cnt++;
          ans = max(ans, cnt);
        }
  cout << ans << '\n';
  return 0;
}

Submission Info

Submission Time
Task B - Humidifier 2
User transparentheart
Language C++ 20 (gcc 12.2)
Score 250
Code Size 754 Byte
Status AC
Exec Time 3 ms
Memory 3648 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 3
AC × 26
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3488 KB
00_sample_01.txt AC 1 ms 3648 KB
00_sample_02.txt AC 1 ms 3492 KB
01_test_00.txt AC 1 ms 3428 KB
01_test_01.txt AC 1 ms 3564 KB
01_test_02.txt AC 1 ms 3436 KB
01_test_03.txt AC 1 ms 3360 KB
01_test_04.txt AC 1 ms 3464 KB
01_test_05.txt AC 1 ms 3436 KB
01_test_06.txt AC 1 ms 3480 KB
01_test_07.txt AC 1 ms 3536 KB
01_test_08.txt AC 1 ms 3492 KB
01_test_09.txt AC 1 ms 3568 KB
01_test_10.txt AC 1 ms 3460 KB
01_test_11.txt AC 1 ms 3532 KB
01_test_12.txt AC 1 ms 3496 KB
01_test_13.txt AC 1 ms 3428 KB
01_test_14.txt AC 1 ms 3560 KB
01_test_15.txt AC 1 ms 3556 KB
01_test_16.txt AC 1 ms 3556 KB
01_test_17.txt AC 1 ms 3560 KB
01_test_18.txt AC 1 ms 3644 KB
01_test_19.txt AC 2 ms 3492 KB
01_test_20.txt AC 3 ms 3492 KB
01_test_21.txt AC 3 ms 3492 KB
01_test_22.txt AC 1 ms 3364 KB


2025-03-28 (Fri)
08:19:45 +00:00