Submission #61089686


Source Code Expand

#include <bits/stdc++.h>
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...)
#endif
using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n, m, x, y;
  cin >> n >> m >> x >> y;
  x--, y--;
  vector<string> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  string T;
  cin >> T;
  set<pair<int, int>> s;
  for (auto ch : T) {
    int x2 = x, y2 = y;
    if (ch == 'U') x2--;
    else if (ch == 'D') x2++;
    else if (ch == 'L') y2--;
    else if (ch == 'R') y2++;
    if (x2 < 0 || x2 >= n || y2 < 0 || y2 >= m || a[x2][y2] == '#') continue;
    x = x2, y = y2;
    if (a[x][y] == '@') s.insert({x, y});
  }
  x++, y++;
  cout << x << ' ' << y << ' ' << s.size() << '\n';

  return 0;
}

Submission Info

Submission Time
Task B - Santa Claus 1
User xindubawukong
Language C++ 20 (gcc 12.2)
Score 200
Code Size 767 Byte
Status AC
Exec Time 2 ms
Memory 3608 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
hand_01.txt AC 1 ms 3536 KiB
hand_02.txt AC 1 ms 3548 KiB
random_01.txt AC 1 ms 3532 KiB
random_02.txt AC 1 ms 3444 KiB
random_03.txt AC 1 ms 3504 KiB
random_04.txt AC 1 ms 3460 KiB
random_05.txt AC 1 ms 3452 KiB
random_06.txt AC 1 ms 3508 KiB
random_07.txt AC 1 ms 3436 KiB
random_08.txt AC 1 ms 3496 KiB
random_09.txt AC 1 ms 3544 KiB
random_10.txt AC 1 ms 3468 KiB
random_11.txt AC 1 ms 3436 KiB
random_12.txt AC 1 ms 3444 KiB
random_13.txt AC 2 ms 3568 KiB
sample_01.txt AC 1 ms 3452 KiB
sample_02.txt AC 1 ms 3488 KiB
sample_03.txt AC 1 ms 3608 KiB