#include <bits/stdc++.h>
#define nemeshay ios_base::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
#define int long long
#define sigma signed
#define pb push_back
#define fr first
#define sc second
#define pii pair<int, int>
using namespace std;
const int N = 1e5 + 2, inf = 1e18 + 7;
pair<pii, char> a[N];
int used[N];
sigma main() {
int n;
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i].fr.fr >> a[i].fr.sc >> a[i].sc;
int q = N;
while (q--) {
map <pii, int> pon;
for (int i = 1; i <= n; i++) {
if (used[i]) continue;
if (a[i].sc == 'N') a[i].fr.sc--;
else if (a[i].sc == 'S') a[i].fr.sc++;
else if (a[i].sc == 'W') a[i].fr.fr--;
else a[i].fr.fr++;
int x = a[i].fr.fr, y = a[i].fr.sc;
if (pon[{x, y}] == 0) pon[{x, y}] = i;
else used[i] = 1, used[pon[{x, y}]] = 1;
}
}
for (int i = 1; i <= n; i++) if (!used[i]) cout << i << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |