Submission #668237

# Submission time Handle Problem Language Result Execution time Memory
668237 2022-12-03T12:11:32 Z 600Mihnea Collecting Mushrooms (NOI18_collectmushrooms) C++17
9 / 100
2000 ms 4244 KB
#include <bits/stdc++.h>


using namespace std;

int main()
{
#ifdef ONPC
  freopen ("input.txt", "r", stdin);
#endif // ONPC

#ifndef ONPC
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#endif // ONPC

  int n, m, r, need;
  cin >> n >> m >> r >> need;
  vector<pair<int, int>> mus, spr;
  for (int i = 0; i < n; i++)
  {
    string s;
    cin >> s;
    assert((int) s.size() == m);
    for (int j = 0; j < m; j++)
    {
      char ch = s[j];
      if (ch == '.')
      {
        continue;
      }
      if (ch == 'S')
      {
        spr.push_back({i, j});
        continue;
      }
      if (ch == 'M')
      {
        mus.push_back({i, j});
        continue;
      }
      assert(0);
    }
  }
  int sol = 0;
  for (auto &it : mus)
  {
    int cnt = 0;
    for (auto &j : mus)
    {
      int d = max(abs(j.first - it.first), abs(j.second - it.second));
      if (d <= r)
      {
        cnt++;
      }
    }
    sol += (cnt >= need);
  }
  cout << sol << "\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 28 ms 340 KB Output is correct
3 Correct 26 ms 396 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 28 ms 340 KB Output is correct
3 Correct 26 ms 396 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 488 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2073 ms 4244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 28 ms 340 KB Output is correct
3 Correct 26 ms 396 KB Output is correct
4 Correct 5 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Halted 0 ms 0 KB -